+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Can I make a dropdown list for a form required?

Can I make a dropdown list for a form required?

4 posts, 0 answered
  1. Ryan
    Ryan avatar
    57 posts
    Registered:
    07 May 2013
    13 Aug 2014
    Link to this post

    I currently see no option to do this. How can I make this a required field, preferably without custom development? Thanks.

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    24 Nov 2016
    18 Aug 2014
    Link to this post
    Hi Ryan,

    Actually, this is possible using a small trick. After you define your choices, set the first choice to be something like "Select a value". Then, go to Advanced settings tab, at the bottom select ValidatorDefiniton. Set the RegularExpression, for instance:
    ^(?!Select a Choice).*$
    This will match all values starting with the entered string - the default value entered. This will force the user to select different value, making the dropdown list as if it is required. The error message shown will be the text in the RegularExpressionViolationMessage field.
    This is the easiest way to achieve the 'required' dropdown, which I can think of, without custom development.
    However, you should change your regular expression if you have set one, to match the not selected value as well, which is a drawback.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Ryan
    Ryan avatar
    57 posts
    Registered:
    07 May 2013
    18 Aug 2014 in reply to Nikola Zagorchev
    Link to this post

    LOL. I actually implemented this exact same approach shortly after I posted the original message. It worked perfectly. Thanks. 

  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    24 Nov 2016
    19 Aug 2014
    Link to this post
    Hello Ryan,

    I am glad you have managed to achieve the desired functionality. Write back if we can help further.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered