[jifty-devel] design pattern for form table input

Steve H s_t_e_v_e_h at hotmail.com
Mon Nov 5 09:36:10 EST 2007


Can you tell me the best way to Submit of a table of data.
An example might be... a customer chooses an arbitrary number of items... these items then display in a table and can have various data added.... say:
 PartNbr   Descr           Qty    DeliveryNotes 
 abc1       some part      [ 5 ]     [ deliver to the back office ]
 def2        different part  [ 3 ]    [ leave in the store room ]
...where the fields in brackets can have data input.
If I were to render (via a template/fragment) a table with $action->form_field('Qty'...) and similarly for DeliveryNotes, the second+ rows of the table render for example as text of Jifty::Web::Form::Field::textarea=HASH(0x123abc).  I'm used to CGI's providing a table of same-named Input fields returned as an array.  Ok, Jifty does it differently... I'm not sure of the design patterns though.  In any event (performance pending) I'd be happy to use a handler (e.g. onchange => { args { ...}}) to process it as it is happening.   ...or alternatively, how might I be able to get the fields from the various table rows to also include for example some additional info like the row number or some other identification to know to which PartNbr (in the eg above) the input belongs... This is why I was thinking of using a onchange handler to do it, although I don't know what the latency to expect for those sort of calls... and importantly, I still don't know how to differently name the form_field to avoid it rendering as text of Jifty::Web::Form::Field::textarea=HASH(0x123abc), and still be able to refer to it as a known named arg in the action.
Maybe I've been looking over and over in the wrong areas of the doco, and there's a straight-forward design pattern for this -- I hope.

Overpaid or Underpaid? Check our comprehensive Salary Centre

More information about the jifty-devel mailing list