Accessing input values inside the form #47
Replies: 4 comments
-
Google Group Date: Mon, 19 May 2014 17:33:42 -0700 On Monday, May 19, 2014 3:04:39 PM UTC-7, Dave Howell wrote:
Agreed, but it's not really possible to do that, at least if you use the
:legend=>nil should do that.
You can access the object for the form via f.obj. I'd use the following f.tag(:td){f.tag(:a, {:href=>"deleteitem?id=#{f.obj.id}")}, ['Delete']}
f.obj will change inside the subform block, so the above code should work Thanks, |
Beta Was this translation helpful? Give feedback.
-
Google Group Date: Mon, 19 May 2014 20:17:00 -0700 On May 19, 2014, at 17:33 , Jeremy Evans [email protected] wrote:
That didn’t work. {puzzled} "undefined local variable or method `f’" |
Beta Was this translation helpful? Give feedback.
-
Google Group Date: Mon, 19 May 2014 22:07:32 -0700 On Monday, May 19, 2014 8:17:00 PM UTC-7, Dave Howell wrote:
Looks like the syntax was a little off, but this should work: f.tag(:td){f.tag(:a, {:href=>"deleteitem?id=#{f.obj.id}"}, ['Delete'])} I don't really understand why you got the error message you did, though, Thanks, |
Beta Was this translation helpful? Give feedback.
-
Google Group Date: Mon, 19 May 2014 22:23:04 -0700 On May 19, 2014, at 22:07 , Jeremy Evans [email protected] wrote:
I was. I’m just a doofus. I’d used single quotes, thus inhibiting the #{xxx} expansion. |
Beta Was this translation helpful? Give feedback.
-
Google Group Post: https://groups.google.com/g/ruby-forme/c/haQySgU9KY8
Google Group Date: Mon, 19 May 2014 15:04:39 -0700
Google Group Sender: [email protected]
Here’s what I’ve got now as the invoice list part of my form:
It would have been nice to do
f.input(:name, :label=>”Name”)
but I don’t have a problem with the individual inputs’ labels being ignored when :grid is true.
Now, you said earlier
That’s not the problem. There’s STILL an “Items” header floating on top of the column header row. Or, rather, there’s a caption there. Neither :caption=>”” nor :attr=>{:caption=>””} would banish the damn thing.
But my key query for this message is the last line.
What’s missing is the bit I need to put after id=
That would be the primary key for the item. How do I access that? My existing solution is to once again process the XML after the form is built. I find the hidden that contains the ID, and build the link with that value:
This will be harder with Forme since I don’t get back the subform as an array with one row per array element; I’ll have to first detect and isolate each row before extracting the ID and adding the delete link.
Or I could . . . .?
Beta Was this translation helpful? Give feedback.
All reactions