c# - Two validation groups -


i have following form: part one: form have fill anyway part two: checkbox if check checkbox see part 2 form if dont check checkbox ,part 2 form hidden

at end of page have send button.

the problem is: whenever not check checkbox , second form hidden doesnt send nothing because button , 2 forms have same validation groups , of course when form 2 hidden nobody fill fields , should cancle somehow validation of them (to stay validation of first form should fill anyway-with or without checkbox).

what best solution/s?

thanks !!!

i'm not expert in best practices asp.net here's general advice can check if checkbox checked or not , validate second form if it's checked. sample pseudocode below:

validate(form1, form2, checkbox)   bool1 = validate(form1)   if(checkbox.checked)     bool2 = validate(form2)     return bool1 && bool2   else     return bool1 

hope helped.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -