VarienForm不适用于magento 1.9.2社区版

时间:2016-04-18 09:52:59

标签: javascript php jquery magento magento-1.9

您好我正在使用magento开发登录和注册表单。对于表单验证,我使用此代码

var registerForm = new VarienForm('register-form', true);

var loginForm = new VarienForm('login-form', true);

if (this.validator && this.validator.validate()) {
    this.form.submit();
}

当我在带有脚本标签的phtml中使用此代码时,它正在工作但是当我将它放入js并通过xml调用时,它不能正常工作是我的xml代码

<custom_abc_index>

    <reference name="root">
        <action method="setTemplate">
            <template>page/1column.phtml</template>
        </action>
    </reference>

   <reference name="head">
        <action method="addItem">
            <type>skin_js</type>
            <name>js/custom_abc/customLoginRegister.js</name>
        </action>
    </reference>

    <reference name="content">
        <block type="custom_abc/custom" name="custom" template="custom_abc/Custom.phtml"></block>
    </reference>


</custom_abc_index>

要检查js是否正在加载,我将alert()放入其中,我得到了弹出窗口,但我不知道为什么验证码不起作用。任何帮助都会很明显。

1 个答案:

答案 0 :(得分:0)

如果您想要更好的简单验证,请在构建的验证类表单验证中使用magento

参考此

Form Validation classes

相关问题