Results 1 to 3 of 3

Thread: Form Validation

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Lancashire UK
    Posts
    375

    Form Validation

    I'm currently stuck on what at first appeared to be a pretty straight forward problem.

    I have an input form that captures a profile of a member (it's for a flying club)
    On the form are check boxes where the member can indicate the types of license held and also textboxes for the the expiry date of these licenses or ratings.

    I want to check that if a checkbox has been selected a date has been entered into the appropriate textbox.

    I have a regular expression that validates the data entered into the Textbox, but no way of testing if it's been left empty.I don't wan't to make it a required field because it's only required if the associated checkbox has been selected.

    In summary how do I test a textbox control for data based on the selection of a checkbox.

    Hope this makes sense

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Form Validation

    Check the value of the checkbox. If the value is true, then check the textbox. If the value of the checkbox is true, and the textbox is empty, popup a messagebox or something indicating an entry must be made.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Lancashire UK
    Posts
    375

    Re: Form Validation

    Thanks for the reply, could you expand a little please ?

    Should I use a custom validate sub to check each control when the form is submitted, then pass it on for processing if all is ok ?

    Sorry if I'm asking basic stuff I'm pretty new to asp.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width