Skip to content

Instantly share code, notes, and snippets.

@deivisonarthur
Created November 14, 2012 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deivisonarthur/4073097 to your computer and use it in GitHub Desktop.
Save deivisonarthur/4073097 to your computer and use it in GitHub Desktop.
unique-taxvat-parte01.phtml
<script type="text/javascript">
$('firstname').addClassName('unico');
Validation.add('unico','Ja existe esse usuario cadastrado!',function(the_field_value){
var url = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)?>unico/verifica.php?firstname=' + $('firstname').value;
var ok = false;
new Ajax.Request(url, {
method: 'get',
asynchronous: false,
onSuccess: function(transport) {
var obj = response = transport.responseText;
//alert (obj);
unico = obj.status_desc;
if (obj) {
Validation.get('unico').error = obj + ' ja usa esse login!';
ok = false;
} else {
ok = true;
}
}
});
return ok;
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment