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

转载请注明出处!


你可能感兴趣的:(Module,table,database,文档,Magento)