dtdvlazd56637 2014-04-16 18:10
浏览 147
已采纳

登录表单无法识别chrome上的输入密码

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 .= "
";
        $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! 
";
                        error = 1;
                    }
                }
                if (error == 1)
                {
                    alert(error_message);
                    return false;
                }
                else
                {
                    submitted = true;
                    document.loginForm.submit();
                    return true;
                }
            }';
        $html .= '</script>';
        $js='
  • 写回答

1条回答 默认 最新

  • dongshuohuan5291 2014-04-16 18:58
    关注

    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")

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法