Hi:

In the case of a has_many :through association, I happily use Hobo's 
select-many tag; however, it sounds like you have a different situation.

I suggest that you take a look at the Rails select_tag: 
http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-select_tag
It can be set up for multiple selections, and it looks to me like you 
should be able to combine table-driven and static selection options. Here 
is a code snippet showing how I have embedded the tag into a dryml page:


          <role_select-view:>
            <%= select_tag "role_select", 
options_from_collection_for_select(Role.order(:name).all, "id", "name", 
:selected => @user.roles.pluck(:id)),  multiple: true,  :size => 10, 
:style=>'width:300px' %>
          </role_select-view:>

Good luck!

Ed G


On Wednesday, March 15, 2017 at 9:08:23 AM UTC-6, donz wrote:
>
> Hi All! 
>
> Hobo has been working great for me for years now, but I just ran into 
> something that I can't figure out (maybe because I'm now 74 years old :-D 
> ). 
>
> I have an app that uses enum_string in one of the fields to produce a 
> standard drop down list.  No Problem. 
>
> I want to change it so that I can populate the drop down list from two 
> static texts and the contents of one of the fields of a second table. 
>
> The original code is: 
>
>    fields do 
>      name              :string, :index => true 
>      * 
>      * 
>      send_to           enum_string('Active 
> Members','Trustees','Specified') 
>      * 
>      * 
>    end 
>
> I changed this field to 
>
>      send_to            string 
>
> which changed the rendered form to use a plain input box. 
>
> I want to produce a drop down list that looks like this: 
>
>      Active Members 
>      Trustees 
>      AMember        #populated from Members table 
>      BMember 
>      CMember 
>      * 
>      ZMember 
>
> etc. 
>
> where the user can select multiple entries. 
>
> The current form contains the following: 
>
>      <field-list fields="subject, body, send_to, specified" param> 
>        <specified-label:>#{ht 'club_email.labels.specified', 
> :default=>'DEFAULT'}</specified-label:> 
>        <body-label:></body-label:> 
>      </field-list> 
>
> The impacted field is send_to. 
>
> Bonus points if the solution only allows multi-select for the 
> AMember..ZMember but not if one of Active Members or Trustees is 
> selected.  (I'll handle this in code otherwise). 
>
> Is there an easy way of doing this?  I looked in the documentation, but 
> could not find a combination to do this without using custom DRYML. 
>
> Thanks, 
>
> Don Ziesig 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to