views:

253

answers:

1

I'm curious how to solve this in a clean way. I've read a few forum posts but couldn't do something that works.

I have a dropdown which — on change — should change a value for a remote_function. The remote_function only needs to be called when the propriate radio button is enabled.

select: download <-- should affect rjs call to get a list
select: upload <-- same thing.. 

o all  <-- hides list
o selected <-- rjs call to get a list
o none <-- hides list

at the moment, it looks like this:

select

form.select :is_download, {'Download' => true, 'Upload' => false}

radio

f.radio_button   :queue, 'selection', 
               { :onchange => remote_function( :url => { :action => 'show_queue' },
                 :with => "'is_download=[VALUE_SHOULD_BE_HERE]&id=#{@range.id}'" ) }

Aim: The RJS does some processing and puts a list into the div, either from local or from remote, based on the value the select item has.

I'm happy about any hint, link or solution.

+2  A: 

Solved it by myself.

I made two radio buttons instead of a select and put a page reload to the onchange which contains the needed params.

pduersteler
Make sure you accept your own answer :P
Toby Hede
I have to wait 48h to do that ;-)
pduersteler