php - form multioptions select -
This is my part of the code and I have to withdraw more than one attribute (piece of information) from the banner status function
/ pre>
$ this-> Setcontext (auto: NTTPMMTTPART); $ This- & gt; SetMethod (auto :: METHOD_POST); $ This- & gt; SetMethod ('post');
// An email element $ this-> AddElement (add '' text ',' banner_title ', array (' label '= & gt;' banner title ',' required '=> true,' filter '=> array (' string trim ')); $ This- & gt; Adelament ('text', 'banner_type', array ('required' = & gt; right, 'filter' => array ('string trim')); $ This- & gt; Element ('checkbox', 'is_active', array ('label' = & gt; 'active', 'required' = & gt; true, 'filter' => array ('string trim')); $ Banner_position = New Zend_Form_Element_Select ('banner_position'); $ Banner_position- & gt; Settlement option ($ this-> getBannerPositions ()) - & gt; Set labels ('banner position'); $ This- & gt; Adelament ($ banner_position, 'banner_position'); $ This- & gt; Adelament ('hidden', 'file_path', array ('required' = & gt; true)); $ This- & gt; Adelment ('submit', 'submit', array ('unseen' = & gt; true, 'label' =>);); } Public function getBannerPositions () {$ db = Zend_Db_Table :: getDefaultAdapter (); $ BannerPosition = $ db- & gt; Fetch Pars ($ db - & gt; Select) - & gt; ('Banner_position'), array ('id', 'banner_position')); Return $ Banner; } }
I solve the problem using zend_Db_expr And in this way I can bring the breadth and height in the box selection of the banner and a multi option box.
$ bannerPosition = $ db- & gt; Fetch Passers ($ db - & gt; Select) - & gt; From ('banner_position', array ('id' = & gt; 'id', 'display_name' = & gt; New Zend_Db_Expr ("CONCAT ('', banner_position, '(W:', width, 'xh:', Height, ')') "))))
Comments
Post a Comment