[jifty-devel] Re: design pattern for form table input

Steve H s_t_e_v_e_h at hotmail.com
Wed Nov 7 20:10:24 EST 2007


I'm sill having problems with this.  Is there a clause in the doco I've overlooked? or am I approaching it the wrong way?  In an olde-worlde CGI way, I could for example munge name= (from the  tag to append a uniq'ifier to later be able to identify fields that weren't submitted due to being empty.  What is the Jifty way to for example allow input of say name=Qty in a simple shopping cart scenario in a table of items? (where only some lines would enter/submit Qty).
... can anyone indicate to me what the Jifty orthodoxy is here?
...or should it be done an olde-worlde way of appending say a line number as in Qty_1 ... Qty_n ... then later iterating the list of submitted args for /Qty_(.+)/.  Thing with this I'd have thought was the declarations needed of Action's ... hence I thought there'd be a Jifty orthodoxy for doing this sort of thing.

regards 
SteveH

>
>
> Hi
>
> 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.

_________________________________________________________________
New music from the Rogue Traders - listen now!
http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=832&referral=hotmailtaglineOct07&URL=http://music.ninemsn.com.au/roguetraders


More information about the jifty-devel mailing list