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.
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 [url=http://doc.silverstripe.org/uniquerestrictedtextfield/]here[/url]. How can i make my DataObject validate this field?
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.
Ah, I've put everything now into validate() but will try to go with AjaxUniqueTextField, which i discovered now :)
AjaxUniqueTextField what then is now the correct function for this?