Changing from radio to checkbox is easy. Changing it to support has_many :through is more difficult, but it shouldn't be too difficult to translate some of the earlier forms in my first post.
By default, Hobo will use a select-many. Use firebug or view-source or something to inspect the HTML produced by Hobo for the select many. Take a look at the *hidden* inputs generated for selected members. Those are the names and values you'll want to use for your checkboxes. Bryan On Mar 30, 1:24 pm, simple_n00b <[email protected]> wrote: > Great! that works perfectly. > > Now what would we need to change to do a group of checkboxes? > > An example of where that might make sense would be after chapter 8 > where there is a many to many relationship defined between categories > and recipes. > > Again in the recipes form, how might I have the list of categories > appear as a group of checkboxes where I could make a multiple > selection? > > Could it be done with a few changes to redefine the radio-one > definition above, to make it a group of checkboxes? > > On Mar 30, 1:04 pm, Bryan Larsen <[email protected]> wrote: > > > > > > > > > Right, the repeat is changing the context. Try this: > > > <!-- radio for a belongs_to --> > > <def tag="radio-one" attrs="options,limit"> > > <% saved_this = this > > conditions = > > ActiveRecord::Associations::BelongsToAssociation.new(this_parent, > > this_field_reflection).conditions if options.nil? > > options ||= this_field_reflection.klass.all(:conditions => > > conditions, :limit => limit).select {|x| can_view?(x)} > > name = param_name_for_this(true) > > %> > > <repeat with="&options"> > > <input type="radio" name="&name" > > value="&this.id" checked="&saved_this==this"/><view/><br/> > > </repeat> > > </def> -- 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.
