#1461: Guarantee order of form population and give preferential treatment to
automatically re-populated forms
--------------------+-------------------------------------------------------
 Reporter:  david   |       Owner:  david
     Type:  task    |      Status:  new  
 Priority:  normal  |   Milestone:  1.0.7
Component:  filter  |     Version:  1.0.6
 Severity:  normal  |    Keywords:       
Has_patch:  0       |  
--------------------+-------------------------------------------------------
 Right now, if you have two forms in the document like this:

 {{{
 #!text/html
 <form id="search" action="/search"><input type="text" name="q" /><input
 type="submit" value="Search" />
 <form id="blah" action="/blah/15/burp"><input type="text" name="yay"
 /><input type="submit" value="Save" />
 }}}

 And you want, in BlahBurpErrorView, to re-populate form "blah", but also
 pre-populate form "search" for user's convenience like so:
 {{{
 #!php
 <?php
 $rq->setAttribute(
   'populate',
   array(
     'search' => new AgaviParameterHolder(array('q' => 'laser beams')),
     'blah' => true,
   ),
   'org.agavi.filter.FormPopulationFilter'
 );
 }}}

 then any error on the "blah" form will be populated onto form "search",
 even if you change the order in the "populate" array so "blah" is listed
 first.

 The reason for this is that the XPath node set does not have any
 guaranteed order, so the code needs to be changed so it fetches each form
 separately to preserve the order.

 But for that to be any useful, we need to put keys with a value of
 {{{true}}} into the first position, so they're always populated before
 others regardless of their position in the "populate" array, since it's
 unlikely that the other forms need any error messages inserted on them.
 Saves users from big "WTF" moments.

-- 
Ticket URL: <http://trac.agavi.org/ticket/1461>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5



_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to