Question

I'm trying to modify the code from the footer, and the login form cannot recognize the password on chrome.
the code works ok on IE9.0, and FF28.0, opera, safari, just not on chrome.
: "Errors have occurred during the of your form! please make the following corrections,

*The 'Password' can not be empty!'

please help!

// Members
$html .= '<div class="members">';
if( $_SESSION['customer_id'] ){
$html .= '<div class="footer_title">'."Customer Login".'</div>';
$html .= '<div><a href="'.gf_href_link("process_cart.php",'','SSL'). '" >'. BOX_HEADING_SHOPPING_CART .'</a></div>';
$html .= '<div><a href="'.gf_href_link("account.php",'','SSL'). '" >'. TXT_MY_ACCOUNT .'</a></div>';
$html .= '<div><a href="'.gf_href_link("logoff.php"). '" >'. TXT_LOGOUT .'</a></div>';
$html .= '<div style="height:10px;"></div>';
} else {
$html .= '<div class="footer_title" style="margin-bottom:5px;">'."Customer Login".'</div>';
$html .= '<form id="loginForm" onsubmit="return check_login()" name="loginForm" method="post" action="">';
$html .= '<div class="footer_email"><input class="email_input1" name="customer_name" type="text" value="'. TXT_ENTER_EMAIL .'" onclick="if(  this.value == '."'".TXT_ENTER_EMAIL."'". ') this.value='."''".';"></div>';
$html .= '<div class="password_login1">';
$html .= '<div class="footer_password">';
/* script */
$html .= '<script type="text/javascript">
function show_password_input(){
$("#tx").hide();
$("#pw").show();
$("#pw").attr("value","");
$("#pw").focus();
    }
</script>';
$html .= '<input class="password_input1" name="customer_password" id="tx" type="text" value="'.TXT_PASSWORD.'"  onfocus="show_password_input();">';
$html .= '<input class="password_input1" name="customer_password" id="pw" type="password" style="display:none;">';
$html .= '</div>';
$html .= '<div class="footer_login">'.gf_image_submit("btn_login.png","login", "class='login_btn1'"). '</div>';
$html .= '<div style="clear:both"></div>';
$html .= '</div>';
$html .= '</form>';
$html .= '<div style="clear:both;text-align:right;padding-right:10px;"><a href="'.gf_href_link("account.php"). '">Register</div>';
}
$html .= '</div>';




$html .= '<script language="javascript">';
        $html .= '$(window).load(function(){
            var left_height = $(".left").height();
            var center_height = $(".center").height();

            if( left_height <= center_height){
                $(".left").attr({style:"height:"+(center_height-20)+"px"});
            }
        });';

        $html .= "\n";
        $html .= 'var submitted = false;
                function check_login() {    
                var error = 0;
                var doberror = 0;
                var error_message = "'.JS_ERROR.'";

                if (submitted == true) {
                    alert("'.JS_ERROR_SUBMITTED.'");
                    return false;
                }
                var email_address = document.loginForm.customer_name.value;
                var customer_password = document.loginForm.customer_password.value;
                if (document.loginForm.elements["customer_name"].type != "hidden") {
                    if(email_address == "" || email_address == "Enter your email address" || email_address.length < '.((CFG_CUSTOMERS_EMAIL_ADDRESS)?CFG_CUSTOMERS_EMAIL_ADDRESS:'0').') {
                        error_message = error_message + "'.JS_EMAIL_ADDRESS.'";
                        error = 1;
                    }
                    else if(!validateEmail(email_address)) {
                        error_message = error_message + "* Sorry, your Email Address is invalid!";
                        error = 1;
                    }
                }
                if (document.loginForm.elements["customer_password"].type != "hidden") {
                    if(customer_password == "") {
                        error_message = error_message + "* The \'Password\' can not be empty! \r\n";
                        error = 1;
                    }
                }
                if (error == 1)
                {
                    alert(error_message);
                    return false;
                }
                else
                {
                    submitted = true;
                    document.loginForm.submit();
                    return true;
                }
            }';
        $html .= '</script>';
        $js='
Was it helpful?

Solution

You have two field with the name customer_password. When a form is submitted the name of input field is used as the name of argument so kindly try changing the name of the hidden password field. you can change its name to customer_password1 (for input with id "tx")

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top