Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I need a code of Jquery effect in login page validation.
i.e., if i enter wrong username and password then the textbox should be use Jquery effect namely shake
Posted
Comments
Karthik_Mahalingam 4-Jan-14 11:07am    
what do you mean by namely shake?
sivamzcet 4-Jan-14 11:36am    
that effect name is shake
Karthik_Mahalingam 4-Jan-14 11:39am    
like this ?

http://api.jqueryui.com/shake-effect/
sivamzcet 4-Jan-14 11:59am    
yehh you right.. but i need this effect will work only if when we give wrong credentials
Karthik_Mahalingam 4-Jan-14 12:06pm    
ok

There are many jQuery plugins for form validation.
See how Google[^] replies me.

If you face any difficulty while coding, feel free to come back here and ask another question with specific issue describing the scenario.

Members will be happy to help you then. :)
 
Share this answer
 
Comments
sivamzcet 4-Jan-14 11:59am    
thanks i will check it now
Glad to hear that. :)

Please accept this answer, if it has helped you in any way.
This will help others to find the answer in one go and you will also be awarded with some points for this action...

Thanks,
Tadit
try like,
modfiy as per your needs..


HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery.js.js"></script>
    <script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript">
        $(function () {

            var iswrongcredential = $('#hdnCheck').val() == 'wrong';
            if (iswrongcredential) {
                $('#txtUserName ,#txtPassword').effect('shake');
            }

        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
        UserName:
        <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox><br />
        Password:<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
        <br />
        <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
        <asp:HiddenField ID="hdnCheck" runat="server" />

    </form>

</body>
</html>



code behind file:


C#
protected void btnLogin_Click(object sender, EventArgs e)
       {
           if (txtUserName.Text == "username" && txtPassword.Text == "password")
           {
               hdnCheck.Value = "correct";
           }
           else
           {
               hdnCheck.Value = "wrong";
           }
       }
 
Share this answer
 
Comments
sivamzcet 4-Jan-14 12:35pm    
i need this in php..
Karthik_Mahalingam 4-Jan-14 12:37pm    
sorry dude, i am a pure dot net developer, i dont know anything about php.

you can do a new post, needing the same in php, you will get help...

might be some php developers who are here ,will help you..
sivamzcet 4-Jan-14 13:00pm    
thanks for your info.. i do my own with your infos
Karthik_Mahalingam 4-Jan-14 13:02pm    
welcome siva, try by your own. google will help you a lot, when u face some issue, u post here.... :)
sivamzcet 4-Jan-14 13:21pm    
Okay karthik can can :) are you in fb?
 
Share this answer
 
v2

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