validation for access one in both , javascript Tirupati, India
  • 12 years 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
  • 12 years 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).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Engineers are all basically high-functioning autistics who have no idea how normal people do stuff.” - Cory Doctorow