i have a form with 2 buttons let say A & B.
The required fields are depending on the button pressed.
Im using actually a DataBinder allowing me to specify requi开发者_StackOverflow社区redFields but for all actions. How can i customize the required fields that will be depending on the button pressed ?
Thanks in advance
If you use <input type="submit" name="button1" value="Click me!" />
you can check for that button1 value in your form and then use different validation rules within your validator. You just have to extend your binding model according to these button names and to give your two buttons different names. Note that this doesn't work with <button type="submit">
in most IE versions and therefor input[type=submit] is the better choice here :-)
精彩评论