# Ajaxy cross-tab form

**URL:** <https://www.ruby-forum.com/t/ajaxy-cross-tab-form/184457>\
**Category:** Rails\
**Created:** [March 2, 2010, 9:21pm UTC](https://www.ruby-forum.com/t/ajaxy-cross-tab-form/184457 "2010-03-02T21:21:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptorrsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@ptorrsmith](https://www.ruby-forum.com/u/ptorrsmith)\
**Post date:** [March 2, 2010, 9:21pm UTC](https://www.ruby-forum.com/t/ajaxy-cross-tab-form/184457/1 "2010-03-02T21:21:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ptorrsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@ptorrsmith](https://www.ruby-forum.com/u/ptorrsmith)\
**Post date:** [March 3, 2010, 12:25am UTC](https://www.ruby-forum.com/t/ajaxy-cross-tab-form/184457/2 "2010-03-03T00:25:01Z")

</div>

On Wed, Mar 3, 2010 at 7:20 AM, ptorrsmith [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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?

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

–

> **[Mikel Lindsaar](https://lindsaar.net/)**
>
> Internet Home for Mikel Lindsaar

---

<div class="post-metadata">

**Author:** ![ptorrsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c6cbf5/32.png) [@ptorrsmith](https://www.ruby-forum.com/u/ptorrsmith)\
**Post date:** [March 4, 2010, 1:28am UTC](https://www.ruby-forum.com/t/ajaxy-cross-tab-form/184457/3 "2010-03-04T01:28:50Z")

</div>

Hi Mikel.

Thanks for that… the HTML5 way looks good, though for the initial  
version may just go the class route 🙂

Thanks  
Peter
