Link to home
Start Free TrialLog in
Avatar of rsheasby
rsheasby

asked on

Logon form

This is driving me crazy. I just don't follow how to fix this.

 Simple logon page
Username
Password
Checkbox "do you agree"

When the checkbox is checked the page drops the password instead of just enabling the logon button It should enable the logon button (which it does) but not post back in a way that it loses the entered password.

So my question is how to change the link to the Java code for the checkbox to enable the logon button without losing the password. I have included the file in hopes that it is a simple change.
ASKER CERTIFIED SOLUTION
Avatar of ransommule
ransommule
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rsheasby
rsheasby

ASKER

I used JQuerry. This response gave me direction thank you

The code used was in two places Here in the head using script <script></script>
 
                               
    <script language="javascript" type="text/javascript">
   
        EnableSubmit = function (val) {
            var sbmt = document.getElementById("btnLogin");

            if (val.checked == true) {
                sbmt.disabled = false;
            }
            else {
                sbmt.disabled = true;
            }
        }
   
 Then for the checkbox
 <input type="checkbox" name="TOS" value="Accept" onclick="EnableSubmit(this)"/> I agree to the acceptable use policy.

and finally how the button was setup

<asp:Button ID="btnLogin" runat="server" Enabled="False" Text="<%$ Resources:btnLogin %>"
                                    ToolTip="<%$ Resources:btnLoginToolTip %>" CssClass="LoginButton" OnClick="btnLogin_Click"
                                    TabIndex="5" />
The button btnLogin is set onload to be disabled so when the checkbox is clicked it enables the button and allows the button to be pushed. Java does not require a post back so the password stays in place. If you can follow how it was UserName Password Yes I aggree Crap now I have to put my password in again to a fluid login.

So using Checkbox onclick and pulling the btnLogin resource in the script section it made a simple