Adding a dollar sign to a text field in Zend Framework -


what & lt; Input & gt; Is there a way to add "$" before to the Zend_Form element? (Using standard ZF accessories would be great, of course).

Edit : For example, if the HTML generated by Zend_Form for a cost element is something like this: (very simple)

  & lt; Label & gt; Price: & lt; / Label & gt; & Lt; Input type = "text" name = "cost" />   

I have to output it to:

      

Using the decorator to insert the HTML you want in your elements For example:

For example, I can:

  $ el1 = $ this- & gt; Create Element ('Text', 'L1') - & gt; SetLabel ('cost:'); // Anonymous function that will generate your custom HTML (requires PHP 5.3) // There are other ways to create anonymous functions for old PHP. $ MyHtml = function ($ content, $ element, array $ option) {return '$'; }; $ El1- & gt; Set decorators ('arrows', 'view halber', 'errors', arrays ('callback', array ('callback' = & gt; $ myHtml, 'placement' => gt; 'PREPEND')), 'labels' / Code>  

It should have the following html code:

  label = "el1" class = "optional" & gt; value: & lt; / label & Gt; $ & lt; input type = "text" name = "L1" id = "L1" value = "" />   

Hope it is helical Or at least you will tell in the right direction.

Comments