1

my jquery validation form is not validate ..here is the code like

    <script type='text/javascript'>
    $(document).ready(function()
    {

    $('#frm').validationEngine('validate');
    });
</script>

<div id='gap'> </div>
    <div id='main'>
        <div id='login-box'>
            <h2><span> ".HD_LOGIN." </span></h2>
            <table align='center'>
            <form id='frm' name='frm' >
                <tr> 
                    <td class='name'> <span>".LBL_USERNAME." </span> </td>
                    <td> <span> &nbsp; </span> </td>
                    <td> <input type='text' name='username' id='username' class='input validate[required]'/><input type='hidden' name='login' value='1' /></td>
                </tr>
                <tr>
                    <td id='error-show'> <span> &nbsp </span> </td> 
                </tr>
                <tr> 
                    <td class='name'> <span>".LBL_PASSWORD."</span></td>
                    <td> <span> &nbsp; </span> </td>
                    <td> <input  type='password' name='password' id='password' class='input validate[required]'/></td> 
                </tr>
                <tr>
                    <td id='error-show'><span> &nbsp; </span> </td> 
                </tr>
                <tr>
                    <td> <span> &nbsp; </span> </td>
                    <td> <span> &nbsp; </span> </td>
                    <td> <input class='chckbx' type='checkbox' name='rememberme' value='1'/> <span> ".CHCK_LOGGED." </span> </td> 
                </tr>
                <tr>
                    <td> <span> &nbsp </span> </td> 
                </tr>
                <tr> 
                    <td colspan='3' align='center'> <input type='button' name='but'  value='login' onclick=\"general_ajax1('modules/login/logincontroller.php',$('#frm').serialize())\"/></td> 
                </tr>

            </form> 

now below is custom ajax

if($("#frm").validationEngine('validate'))
       {
function general_ajax1(urld,data)
{
   $.ajax({
        type:'POST',
        url:urld,
        data:data,
        success: function(response){$('#main_content').html(response);}
        });
    }
}
2
  • Maybe that is an error on your javascript? Your browser console shows something? if you can, post your complete code here so we can test what is going on. Commented Jul 11, 2012 at 9:49
  • @devman no..there's not any warning or error occured. . . .and this is complete code. the #maincontent div is in index page where i linked all scripts. ANd one major problem is button is not operated in firefox.nothing happened in firefox when i click on button. Commented Jul 11, 2012 at 10:16

3 Answers 3

5

The error is in your HTML. You've put a 'form' tag inside a 'table' tag and this is not allowed.

<table align='center'>
     <form id='frm' name='frm' > <---- no!
         <tr> 

You have to do this:

<form id='frm' name='frm' > <---- no!
    <table align='center'>
        <tr> 

Remember to put the '/form' tag outside the '/table' tag in the end of file.

Also, the plugin seems to have a bug (I'm using the the master version on github). The 'validateAttribute' is undefined by default. Configure it on dom ready event.

$(function(){
   $.validationEngine.defaults.validateAttribute = "class";
});

This will put the things in order...

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot devundef, struggling with this for two days. This issue reallys seems to be a bug.
0
<script type='text/javascript'>

    $(document).ready(function(){

        $('#frm').validationEngine();

    });

</script>

Try this way.. and then bind the inputs with class = validate[required]..

Comments

0

in the initiation stage you need to to attach ValidationEngine. so try below in ready function

$(document).ready(function(){ 
    $('#frm').validationEngine('attach'); 
}); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.