magento后台加form表单页面变形

在magento二次开发时,经常需要自己加一些模具,来满足自己的特定需求。

添加Block/里面的文档时,需要特别注意一些地方,其中包括在Form.php中addField的时候,示例代码如下:

$fieldset->addField('todo', 'select', array(
			'label' => Mage::helper('education')->__('Todo'),
			'name' => 'todo',
			'values' => array(
				array(
					'value' => 'do',
					'label' => Mage::helper('education')->__('Do'),
				),
				array(
					'value' => 'dont',
					'label' => Mage::helper('education')->__('Dont'),
				),
				array(
					'value' => '0',
					'label' => Mage::helper('education')->__('Please select'),
				),
			),
		));
		$fieldset->addField('subject', 'text', array(
			'label' => Mage::helper('education')->__('Subject'),
			'name' => 'subject',
		));
		$fieldset->addField('content', 'editor', array(
			'label' => Mage::helper('education')->__('Content'),
			'name' => 'content',
			'style' => 'width:600px; height:400px;',
			'wysiwyg' => true,
		));
你能发现有这段代码什么问题吗?它确实有问题,问题就在content这个单词,在type为editor的情况下,如果id和name为content,页面就会变形,猜测原因可能是content和editor编辑器的样式定义有冲突。
也许不止content一个单词,其他能引起问题的单词暂未发现。

修改之后code如下:

$fieldset->addField('contents', 'editor', array(
			'label' => Mage::helper('education')->__('Content'),
			'name' => 'contents',
			'style' => 'width:600px; height:400px;',
			'wysiwyg' => true,
		));
问题解决!

创建module步骤请参考http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table

转载请注明出处!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值