【发布时间】:2016-04-18 09:52:59
【问题描述】:
您好,我正在使用 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() 放入其中,我得到了弹出窗口,但我不知道为什么验证代码不起作用。任何帮助都会很重要。
【问题讨论】:
标签: javascript php jquery magento magento-1.9