Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET jQuery
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 7-Feb-13 0:40am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
 

$(".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...
  Permalink  
Comments
Santhosh23 at 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 at 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)

  Print Answers RSS
0 OriginalGriff 436
1 Maciej Los 249
2 BillWoodruff 199
3 /\jmot 180
4 Suraj Sahoo | Coding Passion 170
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100