Adam,
Having this exact issue now - my new select drop-down, which is a type
field on the relationship, triggers the event for a new line item.
I don't follow your fix below, but it sounds like dead on for what I need.
Can you share an example? I am trying to use dryml to just add the
dropdown in the existing <select-many> tag, like this:
<roles-view: replace>
> <td><select-many>
> <remove-button: replace>
>
> <input field="role_type"/>
> <input class='remove-item' type='button' value='Remove'/>
> </remove-button:>
> </select-many></td>
> </roles-view:>
Roles connect people and companies, and 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="¶m_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/-/m5Acsy6o3SgJ.
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.