(fwiw, I think part of the issue I'm having is that the name-one docs
at http://cookbook.hobocentral.net/api_tag_defs/name-one are less than
clear)

On Jun 23, 3:46 pm, Montgomery Kosma <[email protected]> wrote:
> Bryan, my Project edit page now looks right, but the autocompleter
> doesn't work and the submit shows the spinner but doesn't appear to
> add the named custodian to my Project (recall Project has_many
> Custodians :through ProjectCustodians).  A further tip would be most
> appreciated (especially by my wife who wants me to stop playing hacker
> and walk down to the beach).
>
>         <after-header: class="add-to-association">
>           <formlet with="&ProjectCustodian.new" update="project-
> custodians" reset-form refocus-form>
>             <div>
>               Name:
>               <name-one:custodian complete-target="&@project"
> completer="new_custodian_name" />
>               <formlet-submit label="Add Custodian"/>
>             </div>
>           </formlet>
>         </after-header:>
>
> with this in my Project controller:
>
>   autocomplete :new_custodian_name do
>     @project = find_instance
>     hobo_completions :name, Custodian.all
>   end
>
> On Jun 23, 10:08 am, Bryan Larsen <[email protected]> wrote:
>
> > Yes, normally you'd use a form, select and submit button instead of a
> > create-button if you actually wanted the create-button to reference a
> > select.   However, as you noted, you cannot nest one form inside each
> > other.  However, you can use "hjq-formlet" from hobo-jquery inside a
> > form.   hjq-formlet only works with AJAX, but since that's what you want...
>
> > Bryan
>
> > Montgomery Kosma wrote:
> > > Trying to use create-button to add a project/custodian pair to my
> > > ProjectCustodian has_many :through table.
>
> > > Here's my create button:
>
> > >           <create-button class="ui-icon ui-icon-circle-plus"
> > > model="ProjectCustodian"
> > >                          update="project-custodians-section"
> > >                          fields="{project_id => #{this.project_id},
> > > custodian_id => ??? }"/>
>
> > > Seems like a simple question -- how do I tell it to use the
> > > custodian_id from the nearby select?
>
> > > Here's the section of the form:
>
> > >         <after-header: class="add-to-association">
> > >           <%
> > >           options = Custodian.all.select {|x| can_view?(x)}
> > >           values = this.*.custodian
> > >           -%>
> > >           <select merge-attrs="&{:disabled => disabled}">
> > >             <option value="">Add Custodian</option>
> > >             <option repeat="&options.sort_by {|x| x.to_s.downcase}"
> > > value="@#{this.id}"
> > >                     merge-attrs="&{:disabled => 'true'} if this.in?
> > > (values)"><%= h this.to_s %></option>
> > >           </select>
> > >           <create-button class="ui-icon ui-icon-circle-plus"
> > > model="ProjectCustodian"
> > >                          update="project-custodians-section"
> > >                          fields="{project_id => #{this.project_id},
> > > custodian_id => ??? }"/>
> > >         </after-header:>
>
> > > Afterthought: I also tried using the Agility tutorial's autocomplete
> > > approach inside <form:project_custodian.new ... > - but couldn't get
> > > that working.  Is that because an embedded <form> inside another
> > > <form> tag is illegal?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to