Traitée How to make a formfield required based on the value of another field

  • Thursday, June 14, 2012 1:24 PM
     
     

    I have a dropdown field on my NewForm.aspx where you have to select a "reason". 

    If you select "other" then i want the text field "reason if other" to become a required field.

    How would i do this?

    thank you!

All Replies

  • Thursday, June 14, 2012 2:11 PM
     
     
    You could use the ASP.NET RequiredFieldValidator. You can turn it on/off based on your dropdown selection. Alternately, you could use a CustomValidator.
  • Thursday, June 14, 2012 2:23 PM
     
     

    thanks for this - i've seen this mentioned as a possiblity but i can't find and tutorials on how to actually do this anywhere - i am really unfamiliar with the validation controls in SP designer but can only find tutorials based on verifying email addresses.

    cheers!

  • Thursday, June 14, 2012 8:28 PM
     
     Answered

    Here's an example where validation of a field is based on another field. They use date fields, but you should be able to modify it for your needs.

    http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/5f0ef32f-d4f4-4897-832c-3d05fbc06c60