0

Currently doing web forms with asp.net. The site is run by hiding and showing divs. I'm working on a help desk area. There are a couple of drop downs which selects what type of problem you have and this makes the correct questions visible, by changing the div to visible. Some parts are mandatory when the div is shown and others are not. This is an example of something in one of my divs:

Customer #: <input type="text" name="customer_number" required="" /><br />

The button at the end of all the divs is run at server and I have a breakpoint right away. The only way I can get to this breakpoint is if I take out the required part of each input. Does anyone know why this is a problem, and how do I fix it?

EDIT:

Wow I just figured it out. I had the wrong problem. Using required="" works but the problem is I have other required things hidden. The button click doesn't work because the hidden ones are still required. I'll have to come up with another work around

  • The required property is a boolean. http://stackoverflow.com/questions/3004703/required-attribute-html5 – Jay Blanchard Jun 20 '14 at 12:42
  • Doesn't the second answer in that say that ="" is valid? – user3113278 Jun 20 '14 at 12:52
  • Keep reading, there is more to know here. – Jay Blanchard Jun 20 '14 at 12:54
  • 1
    Wow I just figured it out. I had the wrong problem. Using required="" works but the problem is I have other required things hidden. The button click doesn't work because the hidden ones are still required. I'll have to come up with another work around. – user3113278 Jun 20 '14 at 13:06
  • Had we seen more of the code / markup we probably could have helped you spot this. Glad you found the problem. Since the inputs are hidden I am guessing that your program should set the values and therefore not be required. – Jay Blanchard Jun 20 '14 at 13:08
  • The program doesn't set the values. In my code there is two drop downs which equals about 30 combinations. The questions, like the one in the example, only show up for a specific combination. I have to figure out how to only require some questions that are visible. – user3113278 Jun 20 '14 at 13:15
  • Actually I think I got it. I'll just add a class to the input fields. Then on the button click call a javascript function that jQuerys the shown div and checks each child for a class that I call required, or something, and just make sure that each one of those has a valid response. – user3113278 Jun 20 '14 at 13:22

0 Answers0