Append to a forms hidden field list

73 views
Skip to first unread message

Bob Sleys

unread,
Jul 11, 2011, 11:59:16 AM7/11/11
to hobo...@googlegroups.com
Is there a hobo way to add to a forms hidden field list?

By default all hobo forms have a hidden-fields div with authenticity_token and page_path in it. I need to add a custom hidden field to a form and was thinking this would be a good place to put it but don't see a good way to do it.

Bob

kevinpfromnm

unread,
Jul 11, 2011, 12:38:33 PM7/11/11
to hobo...@googlegroups.com
Question: what are you trying to add as a hidden field?  Often you can get desired behavior with proper combination of permissions and preset values.

Bob Sleys

unread,
Jul 11, 2011, 1:16:12 PM7/11/11
to hobo...@googlegroups.com
Are you sure you want to open that can of worms LOL.

Ok since you asked.  The problem revolves around a many to many relationship.

Simply put I wan to mimic the hobo standard behavior of adding a child record to a parent that is done though the auto_actions_for in the child controller.

Hobo will created the proper route if you add the auto_actions_for :model_a to say model_b of a many to many between model_a and model_b but dryml auto rapid forms don't work properly.  The auto form falls apart on the  <form owner="model_a" method="post" param> the owner param gives rapid a headache.  So if I remove the owner param I can get the form to generate but then when the new model is saved it doesn't have the appropriate assocation back to model_a.  Thus I'm looking to tuck model_a's id into an hidden field and then on the create method of model_b controller I can grab model_a via the hidden field and make the association.

Hope that made some sense.

Bob

kevinpfromnm

unread,
Jul 11, 2011, 1:24:41 PM7/11/11
to hobo...@googlegroups.com
Yeah, you can just do something like <after-field-list:><hidden-id-field:association /></after-field-list:>

I think you might need to set the relationship manually when you create the object though.

Bryan Larsen

unread,
Jul 11, 2011, 1:31:00 PM7/11/11
to hobo...@googlegroups.com
I have this in pretty much every application.dryml:

<def tag="hidden-field">
<%= hidden_field_tag(param_name_for_this, this) %>
</def>

Perhaps it should be added to Rapid, but it's a common enough pattern
that I'm sure it'd overlap with somebody's own tag somewhere.

I never bother putting it inside the hidden-fields div. Sounds like
the right thing to do in theory, but...

Bryan

> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/EK0KoYJpIe8J.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
>

Bob Sleys

unread,
Jul 11, 2011, 4:15:16 PM7/11/11
to hobo...@googlegroups.com
Thanks guys I got this working. Perhaps if I get some time I'll turn it into a Recipe for the cookbook.

Bob

Owen Dall

unread,
Jul 12, 2011, 6:51:53 AM7/12/11
to hobo...@googlegroups.com
That would be great, Bob.

-Owen

On Mon, Jul 11, 2011 at 4:15 PM, Bob Sleys <bsl...@gmail.com> wrote:
Thanks guys I got this working. Perhaps if I get some time I'll turn it into a Recipe for the cookbook.

Bob

--
You received this message because you are subscribed to the Google Groups "Hobo Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hobousers/-/rQWZhUCndwMJ.

To post to this group, send email to hobo...@googlegroups.com.
To unsubscribe from this group, send email to hobousers+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.



--
Owen Dall, Chief Systems Architect
Barquin International
Reply all
Reply to author
Forward
0 new messages