Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何设置Magento中日期属性的最大值?_Magento_Attributes_Adminhtml - Fatal编程技术网

如何设置Magento中日期属性的最大值?

如何设置Magento中日期属性的最大值?,magento,attributes,adminhtml,Magento,Attributes,Adminhtml,我想设置客户的“出生日期”(dob)属性的最大值 我只想将此日期设置为早于今天(而不是将来)。更改后,我希望在客户编辑屏幕中的adminhtml后端上进行JS验证 我想在模块内的安装脚本中更新此属性。如何做到这一点 提前感谢您的帮助。您必须对其进行编码。管理面板使用原型验证:您可以通过使用验证规则创建自定义JS文件进行扩展,格式如下: if(Validation) { Validation.add AllThese ([ ['validate-dob', // class/

我想设置客户的“出生日期”(dob)属性的最大值

我只想将此日期设置为早于今天(而不是将来)。更改后,我希望在客户编辑屏幕中的adminhtml后端上进行JS验证

我想在模块内的安装脚本中更新此属性。如何做到这一点


提前感谢您的帮助。

您必须对其进行编码。管理面板使用原型验证:您可以通过使用验证规则创建自定义JS文件进行扩展,格式如下:

 if(Validation) {
   Validation.add AllThese ([
    ['validate-dob',    // class/rule name
     'DOB cannot be in the future',  // Error message
      function (v) {
         //  TODO: validation of input, 'v' being the input.
         // return true (input is ok) or false
     }]
      // more rules here, if needed..
  ])};
然后动态地将“validate dob”类添加到customer dob输入字段中。您也可以在该文件中执行此操作。
将要加载的自定义文件添加到adminhtml默认布局中的管理主题中。main.xml。

您必须对其进行编码。管理面板使用原型验证:您可以通过使用验证规则创建自定义JS文件进行扩展,格式如下:

 if(Validation) {
   Validation.add AllThese ([
    ['validate-dob',    // class/rule name
     'DOB cannot be in the future',  // Error message
      function (v) {
         //  TODO: validation of input, 'v' being the input.
         // return true (input is ok) or false
     }]
      // more rules here, if needed..
  ])};
然后动态地将“validate dob”类添加到customer dob输入字段中。您也可以在该文件中执行此操作。
将要加载的自定义文件添加到adminhtml默认布局的管理主题中。main.xml。

您可以创建自己的自定义验证

var theForm = new VarienForm('theForm', true);
Validation.add('validate-dob','You failed to enter baz!',function(the_field_value){
    if(check date)
    {
        return true;
    }
    return false;
});

然后使用local.xml包含js文件

 <adminhtml_sales_order_view>
    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>path/to/validation_dob.js</name></action>
    </reference>
</adminhtml_sales_order_view>

skin_jspath/to/validation_dob.js

您可以创建自己的自定义验证

var theForm = new VarienForm('theForm', true);
Validation.add('validate-dob','You failed to enter baz!',function(the_field_value){
    if(check date)
    {
        return true;
    }
    return false;
});

然后使用local.xml包含js文件

 <adminhtml_sales_order_view>
    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>path/to/validation_dob.js</name></action>
    </reference>
</adminhtml_sales_order_view>

skin_jspath/to/validation_dob.js