Can you give an example of how you fixed this?  I am trying to add a "type" 
column to a many-to-many relationship managed by a select-many, and I am 
running into the same issue.

My added drop-down triggers the new item event.  It's not perfect DRYML, 
but this is how I have managed to have it show up:

<extend tag="form" for="Person"> 

<old-form merge>

 <field-list: replace>

 <field-list fields="first_name, last_name, email, notes, roles">

  <companies-view: replace>

  </companies-view:>

  <roles-view: replace>

  <td><select-many>

   <remove-button: replace>

   &nbsp;&nbsp;&nbsp;&nbsp;

   <input field="role_type"/>

   <input class='remove-item' type='button' value='Remove'/>

   </remove-button:>

  </select-many></td>

  </roles-view:>

 </field-list>

 </field-list:>

</old-form> 

</extend> 
In this example, a person has roles with companies, and roles have a type.

Thanks!

Mike


On Wednesday, July 22, 2009 8:43:20 PM UTC-4, adamski wrote:
>
> Ok, so the problem was solved by replacing  occurances of 
> this.element.down('select') with this.element.down('select.item- 
> select'), and then adding a class of 'item-select' to the select in 
> the select-many tag definition. This allows other select tags to 
> appear within the proto-item definition without causing conflicts. 
>
> I think this would be a good change to make to the Hobo rapid library, 
> and may be one small step to making the tag more customiseable in the 
> future. 
>
>
> On Jul 22, 6:43 pm, adamski <[email protected]> wrote: 
> > Hello 
> > 
> > Having a problem here, with customising the Hobo select-many tag. I 
> > have copied into my own tag. Code is below. 
> > 
> > The problem is from including another select tag in the proto-item 
> > div. We want this in order to give optional roles to users added via 
> > the select-many mechanism. I have tried with other input types and 
> > this seems to work; just there is a conflict with select tags. I've 
> > considered using radio buttons instead but a select is what we want 
> > here. 
> > 
> > If anyone can give any pointers, that ideally dont involve modifying 
> > hobo code or hobo-rapid.js, would be much appreciated! 
> > 
> > Thanks 
> > Adam 
> > 
> > <def tag="select-many-custom" attrs="options, targets, param-name, 
> > remove-label, prompt, disabled, entity-id"><% 
> >   prompt ||= "Add #{this_field.titleize.singularize}" 
> >   options ||= this_field_reflection.klass.all(:conditions 
> > =>this.conditions).select {|x| can_view?(x)} 
> >   values = this 
> >   @param_name  = param_name || param_name_for_this 
> > 
> >   -%> 
> >         <!--p><%=this_field_reflection.klass.to_s%></p--> 
> >   <div class="input select-many" merge-attrs> 
> >     <div style="display:none" class="item-proto"> 
> >       <div class="item" param="proto-item"> 
> > 
> >         <span></span> 
> >           <select name="#{@param_name}[role]" > 
> >              <option value="">Assign role</option> 
> >              <option repeat="&Enumeration.get_values('UserCard.role', 
> > current_user)" value="@#{this.opt_id}"> 
> >                <%= h this.to_s %> 
> >              </option> 
> >           </select> 
> > 
> >         <input type="hidden" name="#{@param_name}[]" param="proto- 
> > hidden"/> 
> >         <input type="button" class="remove-item" value="#{remove_label 
> > || 'x'}" param="proto-remove-button"/> 
> >       </div> 
> >     </div> 
> > 
> >             <select  merge-attrs="&{:disabled => disabled}"> 
> >               <option value=""><prompt/></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> 
> > 
> >     <div class="items"> 
> >       <set param-name="&param_name_for_this"/> 
> >       <div class="item" param="item" repeat> 
> >         <div class="user-selected-span"> 
> >           <span><%=h(this.to_s) %></span> 
> > 
> >           <input type="hidden" name="#{@param_name}[]" value="@#{h 
> > this.id}" disabled="&disabled" 
> >                  param="hidden"/> 
> >           <select name="#{@param_name}[role]" > 
> >              <option value="">Assign role</option> 
> >              <option repeat="&Enumeration.get_values('UserCard.role', 
> > current_user)" value="@#{this.opt_id}"> 
> >                <%= h this.to_s %> 
> >              </option> 
> >           </select> 
> >           <input type="button" class="remove-item" value="# 
> > {remove_label || 'x'}" disabled="&disabled" 
> >                  param="remove-button"/> 
> >         </div> 
> >       </div> 
> >     </div> 
> > 
> >   </div> 
> >         <script type="text/javascript"> 
> >           /** from hobo-rapid.js **/ 
> >             Event.addBehavior({ 
> > 
> >                 'div.select-many.input' : SelectManyInput() 
> >             }); 
> >         </script> 
> > </def>

-- 
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/-/199hojEjYmYJ.
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