SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Password script errors

    On the 'Edit Profile' page of my eCommerce Wordpress Theme (http://www.projectdisobey.com/disobeyclothing), no error message appears when I do any of the following in the ''New Password' and 'Confirm New Password' text fields:

    1. 'New Password' and 'Confirm New Password' do not match.
    2. 'Confirm New Password' field is left empty.
    3. New password is less than 5 characters.
    4. New password is exactly the same as the current password.

    This is the script:

    Code:
    <script language="javascript" type="application/javascript">
    function chk_form_pw()
    {
    if(document.getElementById('new_passwd').value == '')
    {
    alert("<?php _e(ENTER_NW_PW_JS_MSG) ?>");
    document.getElementById('new_passwd').focus();
    return false;
    }
    if(document.getElementById('new_passwd').value.length &lt; 4 )
    {
    alert("<?php _e(ENTER_NW_PW_MIN_JS_MSG) ?>");
    document.getElementById('new_passwd').focus();
    return false;
    }
    if(document.getElementById('cnew_passwd').value == '')
    {
    alert("<?php _e(ENTER_CONFIRMNW_PW_JS_MSG) ?>");
    document.getElementById('cnew_passwd').focus();
    return false;
    }
    if(document.getElementById('cnew_passwd').value.length &lt; 4 )
    {
    alert("<?php _e(ENTER_CONFIRMNW_PW_MIN_JS_MSG) ?>");
    document.getElementById('cnew_passwd').focus();
    return false;
    }
    if(document.getElementById('new_passwd').value != document.getElementById('cnew_passwd').value)
    {
    alert("<?php _e(ENTER_NW_AND_CONFIRM_PW_SAME_JS_MSG) ?>");
    document.getElementById('cnew_passwd').focus();
    return false;
    }
    }
    </script>
    I'd be extremely appreciative if anybody could help me fix the script so that it works as it is meant to. Javascript is not something I'm particularly familiar with...

    Thanks in advance!

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    if(document.getElementById('cnew_passwd').value.length &lt; 4 )

    Was that &lt; in the script? If so you'll need to change it to <
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •