php - Magento edit form fieldset - get value of select dropdown into a label -


I am working on an edit screen for my grid line I am the same I have for this form so far :

  & lt; php class Intellibi_Integration_Block_Adminhtml_Manageasendiapickinglists_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {protected function _prepareForm () {$ form = new Varien_Data_Form (); $ This- & gt; SetForm ($ form); $ Fieldset = $ form- & gt; addFieldset ( 'integration_form', array ( 'Legend' = & gt; Mage :: helper ( 'integration') - & gt; __ ( 'Asenda Pickup Information')); $ Fieldset- & gt; addField ( 'ORDER_NUMBER', 'Label', array ('label' = & gt; Dana :: helper ('integration') - & gt; __ ('order number'), 'name' = & gt; 'serial number')); // Suspended $ fieldset- & gt; addField ('pick_status', 'select', array ('required' = & gt; wrong, 'class' = & gt; 'required-entry', 'label' = & gt; mage: : 'Heli' ('integration') - & gt; __ ('Pick position'), 'name' = & gt; pick_status', 'value' = & gt; Dana :: getSingleton ('IBI / asendiapickstatus') - & GetOptionArray (), 'Read Only' = & gt; 'Read Only ')); // Return Parent :: Snapferm ();}} This administrator generates the following output in the backend:  

 Enter the image details here

What do I want to do pick_status column in a to change the label . When I do this, instead of showing the status value "new", this array displays the index like this:

Enter the image details here

Mer to Scope options array asendiapickstatus has been defined this way in your model:

  class Intellibi_Integration_Model_Asendiapickstatus extends Varien_Object {Const PICK_STATUS_NEW = 1; Const PICK_STATUS_SENT = 2; Const PICK_STATUS_SHIPPED = 3; Stable public function getOptionArray () {return :: array :: PICK_STATUS_NEW = & gt; Dana :: helper ('integration') - & gt; __ ('new'), self :: PICK_STATUS_SENT = & gt; Dana :: helper ('Integration') - & gt; __ ('sent'), manually :: PICK_STATUS_SHIPPED = & gt; Mage :: helper ('integration') -> __ ('ship')); }}   

So my question is; On the edit field fieldbutter, how do I display the dropdown field "pick_status" value instead of the current index? The output will be called "new" instead of "1" as shown above. Will I need a custom renderer?

itemprop = "text">

I have solved this (like this form element with a custom element ):

Added custom fieldset type

  $ fieldset-> AddType ('pickstatus', 'Intellibi_Integration_Block_Adminhtml_Manageasendiapickinglists_Edit_Tab_Form_Renderer_Fieldset_Pickstatus');   

Fields used like this

  $ fieldset-> AddField ('pick_status', 'pickstatus', array ('label' = & gt; Dana :: helper ('integration') - & gt; __ ('pick status'), 'name' = & gt; 'pick_status' ,));   

The rendered such coded

  class Intellibi_Integration_Block_Adminhtml_Manageasendiapickinglists_Edit_Tab_Form_Renderer_Fieldset_Pickstatus extends Varien_Data_Form_Element_Abstract {protected $ _element; Public function getElementHtml () {// Load Pick Position $ pick_status = (int) $ this- & gt; GetValue (); $ Pick_status_list = Dana :: getSingleton ('ibi / asendiapickstatus') - & gt; GetOptionArray (); // Return withdrawal array_key_exists ($ pick_status, $ pick_status_list)? $ Pick_status_list [$ pick_status]: 'Unknown'; }}   

and presents it like this

 Enter image details here

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -