Reputation: 3267
In my magento application the checkout page , will displays error message using validation.js file.
when i click to continue in the new billing address without entereing some value it displays error message as This is required field
..
I want to change this message as its corresponding field name .
Instead of that error message i need to display as First name is a required field
..
How can i do this ?
EDIT
this is the input box which is located in customer/widget/name.phtml as:
<input type="text" id="<?php echo $this->getFieldId('firstname')?>" name="<?php echo $this->getFieldName('firstname')?>" value="<?php echo $this->escapeHtml($this->getObject()->getFirstname()) ?>" title="<?php echo $this->getStoreLabel('firstname') ?>" maxlength="255" class="input-text validate-firstname" <?php echo $this->getFieldParams() ?> />
This is the output.
Upvotes: 1
Views: 9985
Reputation: 963
Add new rule to Validation like below and use that class for input.created new rule required-entry-productids and add class required-entry-productids to input.
Validation.add('required-entry-productids', "Select the atlest one item you would like to return.", function(v) {
return !Validation.get('IsEmpty').test(v);
});
Upvotes: 0
Reputation: 5381
You can create another class in your validation.js file something like validate-firstname
and add something like this in your validation.js file
['validate-firstname', 'First name is required field.', function(v) {
return !Validation.get('IsEmpty').test(v);
}],
Search for this validate-alpha
validation line and after put this code in your js file and add validate-firstname
class in your firstname input field.
Upvotes: 4