Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

UniqueRestrictedTextField broken?

Go to End

4 Posts   1087 Views


Community Member, 88 Posts

3 September 2010 at 8:20pm

Edited: 03/09/2010 8:23pm


I am using SS 2.4.1 and use an UniqueRestrictedTextField inside getCMSFields_forPopup. Although its values are saved, they are not validated and not checked for uniqueness.

		$code = new UniqueRestrictedTextField(
					'Roomcode (must be unique)',
					'This roomcode is already in use.',
					'Only letters and digits are allowed'

I have followed the example from here. How can i make my DataObject validate this field?


Forum Moderator, 5523 Posts

4 September 2010 at 8:17pm

UniqueRestrictedTextField and UniqueTextField are deprecated so you shouldn't rely on its functionality. Having a quick look at UniqueTextField shows that the restricted value lookup looks like its been commented out so you may need to uncomment that and see what that does.


Community Member, 88 Posts

4 September 2010 at 8:40pm

Ah, I've put everything now into validate() but will try to go with AjaxUniqueTextField, which i discovered now :)


Community Member, 11 Posts

11 September 2010 at 7:06am


AjaxUniqueTextField what then is now the correct function for this?