I am dealing with Zend_Form right now and I am having a difficult time figuring out how to:
Use custom images for form buttons and,
Insert text and links in specific places (in my case I want to put a "forgot your password?" link before the submit button).
I've read through the manual but am not seeing anything about this.
I think Zend_Form_Decorators may help you: http://framework.zend.com/manual/en/zend.form.decorators.html
try to read also this article, I think it is the best one about decorators in Zend_Form
http://devzone.zend.com/article/3450-Decorators-with-Zend_Form
for your usage will be most helpful part about "Full Customization Using the ViewScript Decorator", try to find it in article
You can write straight up HTML in your view, just make sure that the element names, select options, hidden values etc. correspond to your Zend_Form elements (or set the element decorators to just ViewHelper and use echo $this->form->element where the elements should be). It's just the same POST data anyway when you submit the form. If you're using the form in more than one place, check out the ViewScript decorator.
CSS?
You can use an element's setDescription() method to add a description to it. If I remember correctly, this renders into a 'p class="hint"' element, but you can of course change that using the form decorators.
Related
I use fabrik for my project. In my website there is many forms that have same fields like national code. So I want to add an element like national code to many groups instead of one group. I don't know what to do this and any helps will be appreciated.
Once created, you could simply copy the element from a group to others. But it's not effective if there is a lot of groups and if you need to change the element regularly.
This problem bring us to create you own Fabrik form element. As I know, Fabrik doesn't propose an easy way to create a custom element type.
Before developing your own element, you can look in Fabrik Elements plug-ins if a generic element could be suitable. Otherwise, you can copy the code of an existing similar plugin and customize it yourself.
You can also check in Fabrik blog if in the future a feature of "Custom Elements" is planned
What I'm trying to do is to add some HTML tags to my Djimageslider's slides titles in joomla 2.5. I will need something like this
something <b>more</b>
but when I click on save or apply then its remove all HTML tags.
I've check the administrator/com_content, which I think should be responsible for inserting the database data, but I couldn't find the answer there.
Can anyone help me with this headache?
The form inputs are "cleaned" by default and you want to tell Joomla not to touch its contents.
Find the component you are using in the url (option=com_djsomething?) I doubt it's com_content.
Once you have the component, you have to find where the form is defined.
The task in the url may help, also the view if it's there. The form can be declared in one of two ways:
by providing an xml manifest, which would be located in the component's folder /models/forms
by inserting it in code, which could be in the component's folder /views/view_name (the default view name would be the component's name, but this can be overridden in the controller so look around).
In both cases, you should be able to find the line that corrensponds to your input, and specify format="raw" as a filter.
Check http://docs.joomla.org/Text_form_field_type for syntax help of the xml manifest, or search the docs for the right JElement in code
The format parameter is optional, if it's not there just add it. Besides "raw" there are other filtering options available, make sure you do filter out undesired input and sanitize your inputs before saving to the db (use $db->quote() to insert field values in the query)
I'm looking for a way to add prefixes for every element of a certain form.
If found this post telling me that there is a elementsBelongTo option which I can use to achieve what I want.
Unfortunately I can't find any documentation explaining the usage. Does anyone know how I can use this option? And if it's still in ZF2?
And furthermore: I there a way to combine it with the nice AnnotationForms?
Don't know if it will help, but instead of prefix you can wrap elements in form or fieldset with form/fieldset name.
You just need to have a name of form or set it and then use setWrapElements
$form->setName('some_name');
$form->setWrapElements(true);
$form->prepare();
from this point full name of element, for example 'password' will be "some_name['password']"
If you are using annotations you can use this with combination of ComposedObject.
It's very good explained here: http://devblog.x2k.co.uk/using-the-composedobject-zend-framework-2-form-annotation/
My site has three columns. I have two fields within a form that need to be in the left column and 1 field of what is currently a different form that needs to be in the middle column. The thing is, I want them to behave as one form... (or be one form if that is possible).
When The form is submitted, the data from all the fields, needs to be passed to the action page.
What is the best way of achieving this? h
If you don't have to support old browsers, you can use the form attribute on some elements to make them behave like they are in the form.
See http://www.impressivewebs.com/html5-form-attribute/
<form id="some_form">
...
</form>
<input form="some_form" />
Else, the better way is to make the form element a parent of all fields. Just move the form element out of the first column.
Columns do not a form make. Wrap all of your column divs in one form tag.
It sounds like you control the code. The simplest solution is to make a single form. What you're looking for is non-standard functionality and whatever solution you settle on my cause problems in the future.
Hey guys, does it make sense to have a submit button within the definition list, as there isn't really a definition term for it?
Seeing as the DL thing is just a decorator scheme, it's kind of an arbitrary discussion.
Maybe something a little more concrete is whether to include your buttons in the same display group as the rest of the elements.
My usual scheme puts any buttons in their own display group (form_buttons).