0

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:

<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!

4
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by harveylester
0

Could you post also the html and the rest of the javascript?

in this part i don't see any errors,

-Agarsia

0

@Agarsia: Here's the HTML...

<form name="registerform" class="registerform" action="http://www.projectdisobey.com/disobeyclothing/?page=myaccount&amp;type=editprofile&amp;chagepw=1" method="post">
<div class="myorders ">
    
        <div class="form_row ">
        <label>
        New Password <span class="indicates">*</span></label>      
        <input type="password" name="new_passwd" id="new_passwd"  class="reg_row_textfield" />
          
        </div>
        <div class="form_row ">
        <label>
        Confirm New Password <span class="indicates">*</span> </label>
        <input type="password" name="cnew_passwd" id="cnew_passwd"  class="reg_row_textfield" />
         </div>
</div>
 <input type="submit" name="Update" value="" class="highlight_input_btn fr" onclick="return chk_form_pw();" />
</form>

I'm not sure what you mean when you say to post the rest of the Javascript (I'm a Javascript newbie).

@stbuchok: The problem I am having is that no error messages are coming up. For example, I can type different passwords in the 'New Password' and 'Confirm New Password' fields and no error message comes up.

0

In line 16, take out the "onclick" event.

<input type="submit" name="Update" value="" class="highlight_input_btn fr">

Then change your line one to...

<form name="registerform" class="registerform" action="http://www.projectdisobey.com/disobeyclothing/?page=myaccount&amp;type=editprofile&amp;chagepw=1" method="post" onsubmit="return chk_form_pw()">

Thanks for your help Taywin, but I tried this and it hasn't made any difference. Any other suggestions?

Thanks again

0

Hmm... Change the script tag to...

<script type="text/javascript">

instead and see how it works? Oh and also change any &lt; to < symbol too. I will look through your script code again...

0

Hmm... Change the script tag to...

<script type="text/javascript">

instead and see how it works? Oh and also change any &lt; to < symbol too. I will look through your script code again...

Thanks! It worked!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.