2016-02-10 73 views
0

我插入自定義確認電子郵件字段但validation.js不起作用。我使用magento 1.9.2.3,並使用registration.phtml文件。我怎樣才能創建一個新的文件夾持久性驗證?Javascript不綁定客戶註冊表格驗證在magento

a:5:{i:0;s:126:"Invalid method Mage_Customer_Block_Form_Register::addJs(Array 
(
    [0] => persistent/customer/form/js/email/validation.js 
) 
)";i:1;s:1902:"#0 [internal function]: Varien_Object->__call('addJs', Array) 
#1 [internal function]: Mage_Customer_Block_Form_Register->addJs('persistent/cust...') 
#2 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Model\Layout.php(348): call_user_func_array(Array, Array) 
#3 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Model\Layout.php(214): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element)) 
#4 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Model\Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) 
#5 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Controller\Varien\Action.php(344): Mage_Core_Model_Layout->generateBlocks() 
#6 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Controller\Varien\Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks() 
#7 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Customer\controllers\AccountController.php(252): Mage_Core_Controller_Varien_Action->loadLayout() 
#8 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Customer_AccountController->createAction() 
#9 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('create') 
#10 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) 
#11 D:\xampp\htdocs\Magento-Project\MYDEMO\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch() 
#12 D:\xampp\htdocs\Magento-Project\MYDEMO\app\Mage.php(683): Mage_Core_Model_App->run(Array) 
#13 D:\xampp\htdocs\Magento-Project\MYDEMO\index.php(87): Mage::run('', 'store') 
#14 {main}";s:3:"url";s:45:"/Magento-Project/MYDEMO/customer/account/create/";s:11:"script_name";s:30:"/Magento-Project/MYDEMO/index.php";s:4:"skin";s:7:"default";} 

回答

0

添加確認電子郵件地址字段在Magento前端形式::在/js/prototype/validation.js

  1. 搜索下面的代碼

    return !(pass.length < 7); }],

此代碼後添加以下代碼:

['validate-cemail', 'Please make sure your emails match.', function(v) { 
var conf = $$('.validate-cemail')[0]; 
var pass = false; 
if ($('email')) { 
pass = $('email'); 
} 
var emailElements = $$('.validate-email'); 
for (var i = 0; i < emailElements.size(); i++) { 
var emailElement = emailElements[i]; 
if (emailElement.up('form').id == conf.up('form').id) { 
pass = emailElement; 
} 
} 
if ($$('.validate-admin-email').size()) { 
pass = $$('.validate-admin-email')[0]; 
} 
return (pass.value == conf.value); 
}], 
  • 然後在PHTML頁必須添加此

    <input type="text" name="confirm_email" id="confirm_email_address" class="input-text required-entry validate-cemail"/>