Hi,

I have an application where I need to select the recipients of an e-mail.
I do this using a combination of the following:

- a checkbox to deliver to all
- a multiple select to select a set of groups

This is currently done with AS - Wondering if this is the best solution.

3 questions:

1) I use this to build the multiple select boxes. They store their 
values fine in the database, but nothing is selected when I edit them.
  Has anybody gotten this to work correctly:

  def klass_ids_form_column(record, input_name)
      select_tag("record[klass_ids][]",
       options_for_select(Klass.find(:all).sort { |a,b| 
a.name.casecmp(b.name)}.collect {|p| [ p.to_label, p.id ] },
       record.klass_ids.collect { |cr| cr.id}), {:multiple=>true, :size=>6})
  end

2) Rather than having a multiple select box I would like a set of check 
boxes. Much more obvious user interface

  is there a simple way to do this ?
  or can the code in 1) be converted like:

  def klass_ids_form_column(record, input_name)

      Klass.find(:all).sort { |a,b| a.grade <=> b.grade}.each do |kl|
        check_box_tag("record[klass_ids][]", "#{kl.id}", 
record[klass_ids].include?(kl.id))
      end
  end

3) And for the really nice version:
Make 2) work, but use AJAX to show/remove the second level of checkboxes 
- they are only shown if all is not checked.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to