code is as follows |
copy code |
//class Ruiwant_consult_block_adminhtml_consult_index_edit_tabs_general extends Mage_adminhtml_block_widget_form protected function _prepareform () { $fieldset 2->addfield (' is_reply ', ' checkbox ', Array ( ' label ' => mage::helper (' consult ')-> __ (' Email to Customer '), ' name ' => ' is_reply ', ' checked ' => true , ' onclick ' => ' this.value = this.checked? 1:0; ', ' after_element_html ' => ' <small>email to Customer if selected </small> ' ); |
But regardless of the adjustment code, the Is_reply value is empty when the post data is fetched from the controller. This problem has been bothering me for nearly 2 hours, and I always wonder why it's empty. Finally, found in Tab2, note that this is a grid list, also contains a field called is_reply, so think is not here except the problem.
code is as follows |
copy code |
//class Ruiwant_consult_block_adminhtml_consult_index_edit_tabs_answer Extends Mage_adminhtml_block_widget_grid protected function _preparecolumns () { $this- >addcolumn (' is_reply ', array ( ' header ' => mage::helper) (' Consult ')->__ (' Email to Customer '), ' index ' => ' is_reply ', & nbsp; ' type ' => ' options ', ' options ' => Array (' 0 ' => ' not Send ', ' 1 ' => ' send '), &nbs p; )); |
After the is_reply in the grid was deleted, it was found that the value was successful. This experience is really pretty depressing. Because two pieces are completely unrelated things, there are assignment operations. Here's a record, it's experience.
Have a very tangled problem, a normal add a form, but the post submitted data when the old submission is not past, get way can, tried for a long time, and then carefully looked at the Magento related forms of code, only to find that each form post data submission, have added a Formkey , specifically as follows:
The code is as follows |
Copy Code |
<?php echo $this->getblockhtml (' Formkey ')?>
|
Generate Code:
The code is as follows |
Copy Code |
<input name= "Form_key" type= "hidden" value= "TXI0VGLAZYEKQUJW"/> |
Magento This should also be done to ensure the security of the submitted form data.