SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery validation

    Hi All,
    I am having problems with validation in JQuery Window.
    Can anyone help me!!!
    I am pasting the code here
    Help needed immediately

    Thnx in advance!!!!


    // validate signup form on keyup and submit
    $("#frmsignup").validate({

    rules: {
    email: {
    required: true,
    email: true
    },
    reemail: {
    required: true,
    email: true
    },
    pass: {
    required: true,
    minlength: 5
    },
    repass: {
    required: true,
    minlength: 5,
    equalTo: "#password"
    },
    name: "required",
    lname: "required",
    terms: "required"
    },
    messages: {
    email: "Please enter a valid email address",
    reemail: "Please enter a valid email address",
    pass: {
    required: "Please provide a password",
    minlength: "Your password must be at least 5 characters long"
    },
    repass: {
    required: "Please provide a password",
    minlength: "Your password must be at least 5 characters long",
    equalTo: "Please enter the same password as above"
    },
    name: "Please enter your firstname",
    lname: "Please enter your lastname",
    terms: "Please accept our policy"
    },
    });







    <form name="frmsignup" id="frmsignup" method="get" action="">
    <tr>
    <td height="24" colspan="0" class="signintext"><img src="images/arrow4.gif" width="7" height="11" align="absmiddle"> Sign Up form</td>
    </tr>
    <tr>
    <td width="139" height="31" align="right">Email ID<span class="style2">*</span> : &nbsp; </td>
    <td width="227"><input name="email" type="text" class="required" id="email" value="" size="30" maxlength="50"></td>
    </tr>
    <tr>
    <td width="139" height="31" align="right">Re-enter Email ID<span class="style2">*</span> : &nbsp; </td>
    <td width="227"><input name="reemail" type="text" class="pagetext" id="reemail" value="" size="30" maxlength="50"></td>
    </tr>
    <tr>
    <td height="24" align="right">Password<span class="style2">*</span> : &nbsp;</td>
    <td><input name="pass" type="password" class="pagetext" id="pass" value="" size="30" maxlength="50"></td>
    </tr>
    <tr>
    <td width="139" height="31" align="right">Re-enterPassword<span class="style2">*</span> : &nbsp; </td>
    <td width="227"><input name="repass" type="password" class="pagetext" id="repass" value="" size="30" maxlength="50"></td>
    </tr>
    <tr>
    <td width="139" height="31" align="right">Your name<span class="style2">*</span> : &nbsp; </td>
    <td width="227"><input name="name" type="text" class="pagetext" id="name" size="30" maxlength="50" value="<?=$name?>"></td>
    </tr>
    <tr>
    <td width="139" height="31" align="right">Last name<span class="style2">*</span> : &nbsp; </td>
    <td width="227"><input name="lname" type="text" class="pagetext" id="lname" size="30" maxlength="50" value="<?=$name?>"></td>
    </tr>
    <tr align="center">
    <td height="31" colspan="2"><input name="terms" type="checkbox" id="terms" value="1" <?=($terms=="1")?"checked":"";?>>
    <span class="signinlinks"><a href="#" onClick="JavaScript:window.open('terms.html','terms','height=450,width=600,scrollbars=yes, resizable=no')" >Accept terms &amp; conditions</a></span> <span class="pagetext style1">*</span></td>
    </tr>
    <tr>
    <td height="36" align="right">&nbsp;</td>
    <td><input name="imageField" type="submit" src="images/button_submit.gif" width="60" height="20" border="0"></td>
    </tr>
    </form>

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Could you explain the issue your having as possible code and saying you are having problems doesn't help us to help you.

    Off Topic:

    Could a moderator please move this to the JavaScript forum

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this validation script is not working in my java script window
    culd u please help me

    I'll explain my prob:

    I displayed a popup jquery window when a link is clicked. and i provided all the controls i mentioned in the above script
    No i am trying to validate these controls
    Hope u got my problem

    Thnx and Regards

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    My next question would be is does the JavaScript load before the HTML and does it load dynamically when the link is clicked?

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It loads before the HTML

  6. #6
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Try moving the JavaScript to after the HTML as the validation can only bind to a form it can see within the current DOM and the way you explain it the HTML gets loaded after the DOM has loaded.

  7. #7
    SitePoint Enthusiast
    Join Date
    May 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thnx a lot Sir!!
    it worked!!!!!

  8. #8
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    No problem, glad you got it working


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •