Magento two times development form domain naming conflict resolution method

Source: Internet
Author: User
Tags form post
  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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.