1

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 .

enter image description here

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() ?> />

enter image description here

This is the output.

4

2 回答 2

4

您可以在您的validation.js 文件中创建另一个类,并在您的validation.js 文件validate-firstname 中添加类似的内容

 ['validate-firstname', 'First name is required field.', function(v) {
            return !Validation.get('IsEmpty').test(v);
        }],

搜索此validate-alpha验证行,然后将此代码放入您的 js 文件并validate-firstname在您的名字输入字段中添加类。

于 2013-05-15T06:12:05.803 回答
0

像下面一样将新规则添加到验证并将该类用于 input.created 新规则required-entry-productids并将类required-entry-productids添加到输入。

 Validation.add('required-entry-productids', "Select the atlest one item you would like to return.", function(v) {
            return !Validation.get('IsEmpty').test(v);
        });
于 2017-11-04T08:24:34.147 回答