问题
The core Magento email validation script I find does not work and continually blocks perfectly good email addresses - I have comment out the validation class in most forms:
<input type="text" name="email" class="input-text validate-email required-entry" />
But I'm getting same issue in admin area for instance in the store email address fields:

I'm trying to find this form so that i can comment out the validation class - but I cant find it,
the template path is adminhtml/default/default/template/widget/form.phtml which contains
<div class="entry-edit">
<?php echo $this->getFormHtml();?>
</div>
<?php echo $this->getChildHtml('form_after');?>
At this point i get a bit lost ?
I have also tried commenting out this in validation.js :
//['validate-email', 'Please enter a valid email address. For example johndoe@domain.com.', function (v) {
//return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
//return Validation.get('IsEmpty').test(v) || /^[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9][\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9\.]{1,30}[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9]@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i.test(v)
// return Validation.get('IsEmpty').test(v) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v)
//}],
But I still get validation message at top of form saying please enter valid email address.
Any help would be appreciated
回答1:
Please overwrite the view file and remove the class "validate-email" from below text box. This will automatically remove validation. You don't need to comment the validation from validation.js
<input type="text" name="email" class="input-text validate-email required-entry" />
回答2:
i think I have solved the issue- I've basically set the checkErrors function in js/mage/adminhtml/form.js to false :
checkErrors : function(result, elm){
if(!result)
elm.setHasError(false, this);
else
elm.setHasError(false, this);
},
This seems to have fixed the issue...
Thanks
来源:https://stackoverflow.com/questions/16317122/how-do-i-remove-email-validation-in-magento-1-7-admin-area