Is there a way to add a "$" right before the <input>
for a Zend_Form element? (using standard ZF stuff would be great, of course).
EDIT: For example, if the html generated by Zend_Form for a cost
element is something like: (very simplified)
<label>Cost:</label>
<input type="text" name="cost" />
I'd like it to output this:
<label>Cost:</label>
$ <input type="text" name="cost" />
You can use callback decorator to put whatever html you want in your elements:
For example in your case I could do:
This should result in the following html code:
Hope this will be helfull or at least point you in the right direction.
Using the AnyMarkup decorator, you could do something this:
As usual, be sure to register the namespace for the decorator with the form. So, if you use the class as named in the linked snippet
My_Decorator_AnyMarkup
located in the fileMy/Decorator/AnyMarkup.php
on the include path, then you'd need something like:$form->addElementPrefixPath('My_Decorator_', 'My/Decorator', 'decorator');
You can add it as a description
And then configure element's decorators properly.
Upd:
Suggested element's decorators:
Note the placement option.