[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Logon form

Posted on 2012-08-23
2
Medium Priority
?
870 Views
Last Modified: 2012-08-27
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.
0
Comment
Question by:rsheasby
2 Comments
 
LVL 2

Accepted Solution

by:
ransommule earned 2000 total points
ID: 38326919
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
0
 

Author Closing Comment

by:rsheasby
ID: 38338295
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question