Logon form

Posted on 2012-08-23
Last Modified: 2012-08-27
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.
Question by:rsheasby
    LVL 2

    Accepted Solution

    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

    Author Closing Comment

    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

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now