OK - problem solved... if anyone is interested, my custom tag looks
like so:

p.s. it does not yet disable the already chosen values on page load.

<def tag="select-many-custom" attrs="options, targets, param-name,
field-name, remove-label, prompt, disabled"><%
  prompt ||= "Add #{this_field.titleize.singularize}"
  options ||= this_field_reflection.klass.all(:conditions
=>this.conditions).select {|x| can_view?(x)}
  field_name ||= 'id'              #allow user to change field for
outputting values (.e.g 'user_id'  )
  values = this

  @param_name ||= param_name_for_this

  -%>
  <div class="input select-many" merge-attrs>
    <div style="display:none" class="item-proto">
      <div class="item" param="proto-item">
        <span></span>
        <input type="hidden" name="#{param_name}[]" param="proto-
hidden"/>
        <input type="button" class="remove-item" value="#{remove_label
|| 'Remove'}" param="proto-remove-button"/>
      </div>
    </div>
    <div class="items">
      <set param-name="&param_name_for_this"/>
      <div class="item" param="item" repeat>
        <span><%= h this.to_s %></span>
        <input type="hidden" name="#...@param_name}[]" value="@#{h
this.send(field_name)}" disabled="&disabled"
               param="hidden"/>
        <input type="button" class="remove-item" value="#{remove_label
|| 'Remove'}" disabled="&disabled"
               param="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)
|| this.to_s.in?(values))"><%= h this.to_s %></option>
    </select>
  </div>
</def>

On Jun 23, 5:48 pm, adamski <[email protected]> wrote:
> I"m trying to make a custom select-many based on Hobo's rapid tag.
> This is mainly because the relationship I need it for is polymorphic
> and does not seem to work with the tag as it is.
>
> The main prob is: I dont get how removing things works?
> Is hobo_update comparing the list with whats in the database to work
> out what to delete? I suspect there is a simple elegant solution here
> that I am not seeing.
>
> Any info much appreciated !
>
> Thx
--~--~---------~--~----~------------~-------~--~----~
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