Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

how to write the script for validations using jquery, i have large form. in this form having 20 tables. All tables display:none. each table having 15-20 fields and in every table first 5 fields are required. and one button like submit

my question is how to show the required fields errors only display block tables.

how to write the jquery script..?

Every table table having the link button. in this button code behind set the table display property like style.Add("display","none") or style.Add("display","block");

when ever click on suit button then shows the validation messages.?

so, how to write the script.?
please help me.

thanks and regards
Posted

1 solution

Please refer this...

JQuery Validation for Registration form containing name, email, mobile number, password[^]

In the above example I written validation with in one form. You just have to do is


JavaScript
$(".table_validate").each(function()
{
   if($(this).attr("display")==="block")
    {
     // here write validation as written in above Tip...
    }
});


In the above code "table_validate" is common class name for all tables. And checking whether the table style is display block or none. If the table style is block then do validation...

Hope this will help you...
 
Share this answer
 
Comments
Santhosh23 7-Feb-13 7:52am    
hi Vinod,

if($(this).attr("display")==="block") this syntax is correct. actually if condition having only == type format support na..?
vinodkumarnie 7-Feb-13 7:56am    
Of course it should support.. But many of jquery developers use ===. So I prefer ===.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900