Jump to:

23377 Posts in 18296 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » UniqueRestrictedTextField broken?

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

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

Page: 1
Go to End
Author Topic: 729 Views
  • dompie
    Avatar
    Community Member
    88 Posts

    UniqueRestrictedTextField broken? Link to this post

    Hello,

    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',
                   'Roomcode (must be unique)',
                   'Room',
                   'This roomcode is already in use.',
                   '[A-Z0-9]{10}',
                   '-',
                   'Only letters and digits are allowed'
          );


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

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: UniqueRestrictedTextField broken? Link to this post

    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.

  • dompie
    Avatar
    Community Member
    88 Posts

    Re: UniqueRestrictedTextField broken? Link to this post

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

  • dayer
    Avatar
    Community Member
    11 Posts

    Re: UniqueRestrictedTextField broken? Link to this post

    Hi,

    AjaxUniqueTextField what then is now the correct function for this?

    Regards.

    729 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.