Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-07-2008, 10:33 PM
Junior Member
 
Join Date: Apr 2008
Posts: 4
Default Multiple Form Element Decorators In Config File

Hi all,

I have read a lot of documentation, tutorials, and experimented a lot.

However, I ran into a snag...

I have the following in my ini configuration file.

elementdecorators.decorator = "ViewHelper"
elementdecorators.datatag.decorator = "HtmlTag"
elementdecorators.datatag.options.tag = "<td>"
elementdecorators.label.decorator = "Label"
elementdecorators.label.options.tag = "<th>"
elementdecorators.rowtag.decorator = "HtmlTag"
elementdecorators.rowtag.options.tag = "<tr>"

When I apply it to my form, it loads, but does not render correctly.

The problem is that I have two HtmlTag decorators and the '<tr>' overwrites the '<td>'.

How do you alias a decorator in a configuration file? This Document says you can do alieses if you want multiple of the same decorator, but I've never seen it done in a config file.

The following was my original code, it renders like I expect (and want).


$this->setElementDecorators(
array(
array('ViewHelper'), // prints the element
array( array('datatag' => 'HtmlTag'), array('tag' => '<td>' )), // wrap the element in a <dt>
array('Label', array('tag' => '<th>')), // prepend the label and wrap it in a <th>
array('HtmlTag', array('tag' => '<tr>')) // wrap the whole thing in a <tr>
)
);

I want to use this decorator on many custom forms without having to copy and paste. I though about making my own decorator, but that seemed like overkill for this (and it looks much more complicated).

Thanks for any help.


Is there another good way to store default configuration?

Last edited by qhas : 04-07-2008 at 10:36 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 02:51 PM
Junior Member
 
Join Date: Apr 2008
Posts: 4
Default Answered

answer

Answer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:20 PM.