我有以下田地 以magento adminhtml形式。
"https://i.sstatic.net/wL6I2.png" alt="我形式的字段"/"
面对我期待的 抓住这个职位, 简单地抛弃它的内容, 在我的拯救行动中这样做。
public function saveAction()
{
if ($this->getRequest()->getPost())
{
try{
$postData = $this->getRequest()->getPost();
echo <pre> ;
print_r($postData);
exit;
输出结果如下。
Array
(
[form_key] => I6jK6swe1EMl0wER
[carrier_code] => test
[postcode] => tescode
[sku] => 123445
)
看我的表情被定义为:
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset( instance_form , array( legend =>Mage::helper( instance )->__( Instance Filters )));
$fieldset->addField( carrier_code , text , array(
label => Mage::helper( instance )->__( Carrier service ),
name => carrier_code ,
after_element_html => <small>Leave blank for all Carriers.</small> ,
));
$fieldset->addField( postcode , text , array(
label => Mage::helper( instance )->__( Postcode ),
name => postcode ,
after_element_html => <small>Leave blank for all Postcodes.</small> ,
));
$fieldset->addField( sku , text , array(
label => Mage::helper( instance )->__( Sku ),
name => sku ,
after_element_html => <small>Leave blank for all Skus.</small> ,
));
$fieldset->addField( start_date , date , array(
label => Mage::helper( instance )->__( Start Date ),
after_element_html => <small>Comments</small> ,
tabindex => 1,
image => $this->getSkinUrl( images/grid-cal.gif ),
format => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)
));
$fieldset->addField( aura , file , array(
label => Mage::helper( instance )->__( Upload ),
value => Uplaod ,
disabled => false,
readonly => true,
after_element_html => <small>Comments</small> ,
tabindex => 1
));
我期待看到这样的产出:
Array
(
[form_key] => I6jK6swe1EMl0wER
[carrier_code] => test
[postcode] => tescode
[sku] => 123445
[start_date] => someValue
[aura] => anotherValue
)
我漏掉了什么? 为什么会说日期字段, 而不是添加到该文章中, 像所有其他文本输入字段一样?
干杯 干杯