Ajaxy cross-tab form

Hiya'll.

I'm trying to create an ajaxy form full of intersect values in which each intersect-field can be edited (in place style) and submitted back on change.

I have 3 models :people (name) :wants (name) :people_wants (person_id, want_id, importance) #importance of this want for this person, if at all.

I want to spit out a grid effectively with people along the top and wants down the side, and in the intersect spots have an in-place-edit field for the "importance" value (if there is one, otherwise it will be created when an importance value is entered).

Any suggestions as to how to structure the form so each intersect field is aware of its person_id and it's want_id and this is passed back on the XHR for updating?

Thanks

Peter

Add something to each cell as you generate it which corresponds to the column and row the cell is in.

If you want to do it the html5 way, you can add data-attributes as you generate the table - which semantically would be the best bet.

If you don't want to go that way, add a class to each cell, one for each column (you work out the row by just looking at the class of the nearest parent tr), then get your cell to work out what classes it has as they are updated.

Mikel

Hi Mikel.

Thanks for that... the HTML5 way looks good, though for the initial version may just go the class route :slight_smile:

Thanks Peter