Logon form

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

 Simple logon page
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.
Who is Participating?
ransommuleConnect With a Mentor Commented:
The javascript that shows/hides login button must end with return false;

Using JQuery, you could use event.preventDefault();

This also can be caused by a Javascript syntax error.

Also you could use an update panel
rsheasbyAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.