Community discussion forum

validation for access one in both

  • 1 year ago
    Hi, Iam having fileupload and textbox controls in my page. now i want to give the validation for user can use only one in that. if he use fileupload then also he used textbox means it give message using client side script. similarly for textbox also
  • 1 year ago

    There are many ways to handle mutually exclusive form inputs.

    You can use JavaScript to validate exclusivity client-side. You can also create a custom validation control.

    I would chose the quickest and easiest method (in lieu of elegance). I'd design my form so the user has to pick which option he wants (upload a file, or put text in the textbox) by making him choose the option in a RadioButtonList (already mutually exclusive). If the user selects (file upload) then your code would ignore the value in the textbox. Likewise, if the user selects the "textbox" option, then your code would ignore the file upload data when the form is submitted.

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!