fresher
fresher

Reputation: 911

Change the error message for validation

I am using following link for displaying validation error messages.

as I am using this : validate-length I am getting error message as :

Text length does not satisfy specified text range , but I want to change this message as:

"Zip code is not servicable"

<input placeholder="Enter your PIN Code" class="input-text 
   <?php if ($this->isFieldRequired('postcode')):?>
      required-entry
   <?php endif;?> 

   validate-length maximum-length-6 minimum-length-6 validate-digits"
   type="text"
   id="estimate_postcode"
   name="estimate[postcode]" 
   value="<?php echo $this->htmlEscape($this->getFieldValue('postcode')) ?>" 
   onkeydown="if (event.keyCode == 13) { return false;}"
/>

Upvotes: 1

Views: 522

Answers (1)

Gilko
Gilko

Reputation: 2387

Make your own javascript file:

For example override.js and put it in the js folder of your project.

Then write this code in that override.js file:

Validation.add('validate-length', 'Zip code is not servicable')

In the layout file you need to add that js file with the addJs method:

<action method="addJs"><script>override.js</script></action>

Upvotes: 1

Related Questions