Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Replacing JS in an online form

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #167296
    Everton
    Participant

    Hello

    I have a Web site here which the CSS people at CSS-tricks have kindly helped me with: Lost password form.

    The ‘Request password’ link does not work and, in any case, the script at the moment uses JavaScript, which I have been advised against. The relevant part of the script is:

    <form name="Password" method="post" action="confirm.asp">
            <div class="logo_text">
              <h2>Lost Password?</h2>
            </div>
    
            <div class="logo_text">
              <h3>Please enter a valid Email address</h3>
            </div>
            <input id="submitlink" type="text" name="Email" />
           <a href="javascript:mysubmit()">Request password</a> 
          </form> 

    Basically, I wish to replace that javascript:mysubmit() line with a text link (as it is at the moment), but one which does not rely on JavaScript to do it.

    I get various errors whatever I have tried and would be grateful for some advice.

    Thank you.

    Everton

    #167326
    Everton
    Participant

    Thanks nkrisc for your reply.

    OK, at the moment I have a line of code that says:

    <h3>Please enter a valid Email address</h3> which is fine. Then, under that line of code an input field for an email address again, as it does at the moment, and that is fine.

    Ideally, under that field I would like a text link, such as the one I have posted (Lost password form), which does not use JavaScript (as some visitors have JavaScript disabled).

    That’s what I don’t know how to do.

    #167355
    Everton
    Participant

    The only piece of JS there at the moment is:

    <a href="javascript:mysubmit()">Request password</a>

    which I will remove, but the general idea is that on clicking the link (or button that looks like a link), the user will be directed to this file: action=”confirm.asp“>. This file searches the database for the users password against his given email address and sends that password to the user.

    I was hoping to remove that line of JS and replace it with a piece of code that displayed a ‘request password’ link under the input field that did just that.

    #167423
    Podders
    Participant

    You can’t submit a form using an anchor without using Javascript, you can however submit the form using a button and style the button to resemble an anchor,

    http://codepen.io/Podders/pen/puofH/

    #167426
    Everton
    Participant

    Thank you so much, Podders!

    I have messed about with this code for hours attempting various combinations of script, and you have finally done it!

    Password request form

    It not only looks better but the ‘lost password request’ works!

    Cheers!

    Everton

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.