View Single Post
  #4 (permalink)  
Old 03-03-2008, 10:33 AM
mcleod@spaceweb.nl mcleod@spaceweb.nl is offline
Junior Member
 
Join Date: Mar 2008
Posts: 4
Default use decorators

Quote:
Originally Posted by murugesanme View Post
See here i am giving you a small HTML script for a login page. I hope you can understand the output of this code. So, what i need is, i want to design a large page to get nearly 40 values form the users . So, you can think the size of the form and the alignment. when i am using the Zend Form Class, i am not getting my required design output and the tags contains "dd" and "dt" . Instead of that i want to emmbed my entire form within a table and to display the lables and fields in separate TR,TD,s and Right side of each fields i want to add some commens about the field. I hope you understand my requirement.
- Give me a good solution.

HTML Code:
<FORM METHOD=POST ACTION="">
<TABLE>
<TR>
	<TD>User Name</TD>
	<TD><INPUT TYPE="text" NAME=""></TD>
</TR>
<TR>
	<TD>Password</TD>
	<TD><INPUT TYPE="text" NAME=""></TD>
</TR>
</TABLE>
</FORM>

- Thanks
-Mugesh

It is not recommended that you use table formatting unless you want to represent tabular data, but if you really want, it is possible. You should however keep in mind that the default decorators (dd and dt) seem to be used to place error messages inside the form, in case the form does not validate.

There are at least three ways for you to go:
1. Use css to align the dd and dt tags the way you want. I suggest you experiment with this before you do anything else
2. Remove all decorators by calling clearDecorators() on the form elements, but you will also not see the form element after that. The default decorators are View_Helper and Label. Discarding them all will leave you with a blank form. If you add the View_Helper decorater after the clearance you will see a form with unaligned elements (all on one line). You can now add html_tag decorators that you can initialize so that they will display td tags. They are relatively easy to work with.
3. Just add html_tag decorators to the decorator stack and leave the default decorators in place.

I hope this helps. If you don't get how the html_tag decorator works, it helps to look into the code in the library, it is very clearly written.

Bart McLeod
Reply With Quote