Setting session variable with a checkbox


#1

Hi:

Is there a way to set a session variable in a check box that’s not in a
form nor linked to a controller? The checkbox value would also be the
value of the session variable I want it to set. I assume I have to put
this in a form. Any suggestions?

Thanks very much in advance!

Mike


#2

Mike D. wrote:

Hi:

Is there a way to set a session variable in a check box that’s not in a
form nor linked to a controller? The checkbox value would also be the
value of the session variable I want it to set. I assume I have to put
this in a form. Any suggestions?

Thanks very much in advance!

Mike

just an idea, but you could do an ajax call on an onchange event of the
checking-of-the-box:

create the function

and then just do an action in the ExampleController

def set
session[:checkbox] = params[:session_setter]
render :nothing => true
end

all untested code…might need to modify the ajax statement above to
pass the param[:session_setter] in “parameters:…” but an idea, no?
hth