`
yushine
  • 浏览: 200443 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

magento admin form 表单元素大全

 
阅读更多

 

1.input type=”text”

$fieldset->addField(‘title’, ‘text’, array(
‘label’     => Mage::helper(‘form’)->__(‘Title3′),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “alert(‘on click’);”,
‘onchange’ => “alert(‘on change’);”,
‘style’   => “border:10px”,
‘value’  => ‘hello !!’,
‘disabled’ => false,
‘readonly’ => true,
‘after_element_html’ => ‘Comments’,
‘tabindex’ => 1
));
2.Time时间类型

$fieldset->addField(‘time’, ‘time’, array(
‘label’     => Mage::helper(‘form’)->__(‘Time’),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ’12,04,15′,
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

3.textarea

$fieldset->addField(‘textarea’, ‘textarea’, array(
‘label’     => Mage::helper(‘form’)->__(‘TextArea’),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ‘<b><b/>’,
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ‘<small>Comments</small>’,
‘tabindex’ => 1
));

4.input type=”submit”

$fieldset->addField(‘submit’, ‘submit’, array(
‘label’     => Mage::helper(‘form’)->__(‘Submit’),
‘required’  => true,
‘value’  => ‘Submit’,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

5.select option

$fieldset->addField(‘select’, ‘select’, array(
‘label’     => Mage::helper(‘form’)->__(‘Select’),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ’1′,
‘values’ => array(‘-1′=>’Please Select..’,’1′ => ‘Option1′,’2′ => ‘Option2′, ’3′ => ‘Option3′),
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

6.带optgroup的select

$fieldset->addField(‘select2′, ‘select’, array(
‘label’     => Mage::helper(‘form’)->__(‘Select Type2′),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ’4′,
‘values’ => array(
‘-1′=>’Please Select..’,
’1′ => array(
‘value’=> array(array(‘value’=>’2′ , ‘label’ => ‘Option2′) , array

(‘value’=>’3′ , ‘label’ =>’Option3′) ),
‘label’ => ‘Size’
),
’2′ => array(
‘value’=> array(array(‘value’=>’4′ , ‘label’ => ‘Option4′) , array

(‘value’=>’5′ , ‘label’ =>’Option5′) ),
‘label’ => ‘Color’
),
),
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

7.单选框input type=”radio”

$fieldset->addField(‘radio’, ‘radio’, array(
‘label’     => Mage::helper(‘form’)->__(‘Radio’),
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ’1′,
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));
$fieldset->addField(‘radio2′, ‘radios’, array(
‘label’     => Mage::helper(‘form’)->__(‘Radios’),
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ’2′,
‘values’ => array(
array(‘value’=>’1′,’label’=>’Radio1′),
array(‘value’=>’2′,’label’=>’Radio2′),
array(‘value’=>’3′,’label’=>’Radio3′),
),
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

8.Password元素 input type=”password

$fieldset->addField(‘password’, ‘password’, array(
‘label’     => Mage::helper(‘form’)->__(‘Password’),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘style’   => “”,
‘value’  => ‘hello !!’,
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

$fieldset->addField(‘obscure’, ‘obscure’, array(
‘label’     => Mage::helper(‘form’)->__(‘Obscure’),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘obscure’,
‘onclick’ => “”,
‘onchange’ => “”,
‘style’   => “”,
‘value’  => ’123456789′,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

9.Note

$fieldset->addField(‘note’, ‘note’, array(
‘text’     => Mage::helper(‘form’)->__(‘Text Text’),
));

10.Multiselect复选框

$fieldset->addField(‘multiselect2′, ‘multiselect’, array(
‘label’     => Mage::helper(‘form’)->__(‘Select Type2′),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “return false;”,
‘onchange’ => “return false;”,
‘value’  => ’4′,
‘values’ => array(
‘-1′=> array( ‘label’ => ‘Please Select..’, ‘value’ => ‘-1′),
’1′ => array(
‘value’=> array(array(‘value’=>’2′ , ‘label’ => ‘Option2′) , array

(‘value’=>’3′ , ‘label’ =>’Option3′) ),
‘label’ => ‘Size’
),
’2′ => array(
‘value’=> array(array(‘value’=>’4′ , ‘label’ => ‘Option4′) , array

(‘value’=>’5′ , ‘label’ =>’Option5′) ),
‘label’ => ‘Color’
),
),
‘disabled’ => false,
‘readonly’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

11.Multiline

$fieldset->addField(‘multiline’, ‘multiline’, array(
‘label’     => Mage::helper(‘form’)->__(‘Multi Line’),
‘class’     => ‘required-entry’,
‘required’  => true,
‘name’      => ‘title’,
‘onclick’ => “”,
‘onchange’ => “”,
‘style’   => “border:10px”,
‘value’  => ‘hello !!’,
‘disabled’ => false,
‘readonly’ => true,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

12.Link 链接

$fieldset->addField(‘link’, ‘link’, array(
‘label’     => Mage::helper(‘form’)->__(‘Link’),
‘style’   => “”,
‘href’ => ‘www.excellencemagentoblog.com’,
‘value’  => ‘Magento Blog’,
‘after_element_html’ => ”
));

13.普通Label

$fieldset->addField(‘label’, ‘label’, array(
‘value’     => Mage::helper(‘form’)->__(‘Label Text’),
));

14.Image Upload图片上传

$fieldset->addField(‘image’, ‘image’, array(
‘value’     => ‘http://www.excellencemagentoblog.com/wp-content/themes/excelltheme/images/logo.png’,
));

15.File Upload文件上传

$fieldset->addField(‘file’, ‘file’, array(
‘label’     => Mage::helper(‘form’)->__(‘Upload’),
‘value’  => ‘Uplaod’,
‘disabled’ => false,
‘readonly’ => true,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

16.日期Date

$fieldset->addField(‘date’, ‘date’, array(
‘label’     => Mage::helper(‘form’)->__(‘Date’),
‘after_element_html’ => ”,
‘tabindex’ => 1,
‘image’ => $this->getSkinUrl(‘images/grid-cal.gif’),
‘format’ => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)
));

17.Checkbox

$fieldset->addField(‘checkbox’, ‘checkbox’, array(
‘label’     => Mage::helper(‘form’)->__(‘Checkbox’),
‘name’      => ‘Checkbox’,
‘checked’ => false,
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ’1′,
‘disabled’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));
$fieldset->addField(‘checkboxes’, ‘checkboxes’, array(
‘label’     => Mage::helper(‘form’)->__(‘Checkboxs’),
‘name’      => ‘Checkbox’,
‘values’ => array(
array(‘value’=>’1′,’label’=>’Checkbox1′),
array(‘value’=>’2′,’label’=>’Checkbox2′),
array(‘value’=>’3′,’label’=>’Checkbox3′),
),
‘onclick’ => “”,
‘onchange’ => “”,
‘value’  => ’1′,
‘disabled’ => false,
‘after_element_html’ => ”,
‘tabindex’ => 1
));

分享到:
评论

相关推荐

    Magento: 后台添加预览按钮 View product in frontend from Magento admin

    这篇博客“Magento:后台添加预览按钮 View product in frontend from Magento admin”主要探讨了如何通过自定义开发来实现这一功能,让管理员能够快速检查商品在网站前台的显示状态。 在Magento中,通常管理员需要...

    magento二次开发大全

    6. **后台功能和表单元素**:Magento的后台管理界面允许管理员配置商店的各种设置。`后台功能列表.mmap`和`后台表单元素.txt`可能包含了关于如何创建和自定义后台功能及表单元素的信息。 7. **运行流程**:`运行...

    magento2-form-field-manager:Magento2的客户和地址表单字段经理

    Magento2的客户和地址表单字段经理 快速轻松地从管理员订单创建和客户帐户中删除不需要的表单字段,默认情况下是magento或其他第三方扩展添加的之后(创建管理订单)特征从以下内容中删除不需要的表单字段: 管理员...

    Magento 自定义后台menu Insert dynamical menu in Magento’s Admin

    本篇文章将详细解析如何在Magento的Admin中实现自定义动态菜单。 首先,我们需要理解Magento的菜单结构。Magento的后台菜单主要由` Mage_Adminhtml_Block_Menu`类控制,它通过遍历系统配置中的`adminhtml/menu`节点...

    magento-query-grid:在 Magento Admin 中将任何 SQL 查询结果显示为网格和图表

    在 Magento Admin 中将任何 SQL 查询结果显示为网格和图表 在 Magento 1.9.x 上安装 使用安装: $ cd /path/to/magento $ modgit init $ modgit clone querygrid ...

    Ajax-magento2-ajax-cart-quick.zip

    Ajax-magento2-ajax-cart-quick.zip,magento 2 ajax购物车扩展插件提供舒适的购物体验。客户可以很容易地选择可配置的选项并在弹出窗口中编辑项目,而不会浪费重新加载页面的时间。,ajax代表异步javascript和xml。它...

    Magento Events CheatSheet (Magento事件速查表)

    ### Magento 事件速查表详解 #### 概述 Magento 是一个广受欢迎的开源电子商务平台,为开发者提供了高度可定制性和灵活性。为了更好地利用 Magento 的功能进行模块开发或扩展,理解其事件系统至关重要。本篇文章将...

    magento-admin-theme:让您的Magento管理员焕然一新

    在Magento 1.7.x,1.8.x,1.9.x上安装使用安装: $ cd /path/to/magento$ modgit init$ modgit clone admin-theme https://github.com/jreinke/magento-admin-theme.git或手动下载软件包: 下载最新版本从管理员注销...

    最新magento免费主题模板-FreepopTheme

    该magento主题模板掺杂流行元素,清爽、美观,较适合做服装类网站。由kivin提供免费下载。注:欢迎到http://topmagento.com/ magento技术博客交流。那里还有几款漂亮的magento模板供大家免费下载。

    Magento

    7. **安全设置**:安装完成后,应移除安装目录,修改默认的admin路径(如 `admin_yourcustompath`),并配置合适的权限。 8. **优化性能**:为了提高Magento的运行效率,可以进行一些性能优化,比如启用OpCache、...

    magento数据结构分析

    标题:“Magento数据结构分析” 描述:“Magento数据字典”提供了对Magento系统中各种数据库表的深入理解,这对于理解和优化Magento的性能至关重要。 一、Magento数据结构解析 Magento是一款功能强大的电子商务...

    magento入门学习资料

    XML文件在Magento中起着核心作用,它们定义了模块结构、布局、配置和主题元素。如`config.xml`用于模块配置,`layout.xml`控制页面元素布局,`local.xml`则允许对默认布局进行自定义。掌握XML语法和这些文件的用途...

    magento-admin-logger:来自 Miguel Balparda 的 Magento Admin Logger

    magento-admin-logger 来自 Miguel Balparda 的 Magento Admin Logger 这是 Magento Connect 上可用的模块。 我们将在这里维护它。 (Wagento)

    magento快速复制网站_magento_magento快速复制站_

    在电商领域,经常会有需求将一个已经建立并运行良好的Magento站点快速复制到另一个服务器,用于测试、备份或者创建一个新的独立站点。这个过程涉及到数据库的备份与还原、文件系统的复制以及配置的调整等多个步骤。 ...

    magik shoes magento 模板, magento 1.7 模板

    在这款模板中,开发者考虑到了鞋子销售的特殊性,如产品展示、分类、颜色选择、尺码指南等关键元素,以提供一个专业且用户友好的界面。 Magento 1.7是Magento的一个重要版本,它包含了多项改进和增强,例如性能优化...

    magento事件清单

    这些事件在CMS页面编辑时触发,分别对应内容、设计和主要信息选项卡的表单准备阶段,参数`$form`为当前表单对象,提供了修改表单结构或增加自定义字段的机会。 ### 3. 结论 理解Magento的事件机制及其参数是定制和...

    Magento插件开发手册 Magento Extension Developers Guide

    11. **后端开发**:设计和实现插件的后端界面,包括配置、列表视图和编辑表单。 ### 高级主题 - **信任插件开发**:了解如何创建受信任的插件,包括安全性考虑和最佳实践。 - **Magento最佳实践**:深入探讨开发...

    Magento 2 Beginners Guide

    Protect Magento instance admin from unexpected intrusions Set up newsletter and transactional emails so that communication from your website corresponds to the website’s look and feel Make the store ...

    magento图片延时加载插件

    在电商网站中,图片是至关重要的元素,它们可以展示产品细节,吸引顾客注意力。然而,大量的图片也会对网站性能造成影响,导致页面加载速度变慢,用户体验下降。这就是“magento图片延时加载插件”发挥作用的地方。 ...

Global site tag (gtag.js) - Google Analytics