Global Variables for a Search Toggle ?

Hi, i'm adding a searching part to my app and need to give the user an easy way to toggle between searching by Registered / Activity

Basically there will be a line of text at the top saying 'Searching by : Registered', when the user clicks Registered (a link) it will revert it to searching by Activity, and vice versa.

Should be simple enough but i've experimented with cookies and global variables in Ruby and getting nowhere fast.

Should basically be a method which is fired when the user clicks the link and in turn flips a variables value from 1 to 0 and back again.

Any ideas, stumped,

John Griffiths wrote:

Hi, i'm adding a searching part to my app and need to give the user an easy way to toggle between searching by Registered / Activity

Basically there will be a line of text at the top saying 'Searching by : Registered', when the user clicks Registered (a link) it will revert it to searching by Activity, and vice versa.

Should be simple enough but i've experimented with cookies and global variables in Ruby and getting nowhere fast.

Should basically be a method which is fired when the user clicks the link and in turn flips a variables value from 1 to 0 and back again.

Any ideas, stumped,

def toggle_regisistered_activity   session[:reg_ac] ||= false   (session[:reg_ac] = !session[:reg_ac]) ? (:registerd) : (:activity) end

hth

ilan

Ilan Berci wrote:

John Griffiths wrote:

Hi, i'm adding a searching part to my app and need to give the user an easy way to toggle between searching by Registered / Activity

Basically there will be a line of text at the top saying 'Searching by : Registered', when the user clicks Registered (a link) it will revert it to searching by Activity, and vice versa.

Should be simple enough but i've experimented with cookies and global variables in Ruby and getting nowhere fast.

Should basically be a method which is fired when the user clicks the link and in turn flips a variables value from 1 to 0 and back again.

Any ideas, stumped,

def toggle_regisistered_activity   session[:reg_ac] ||= false   (session[:reg_ac] = !session[:reg_ac]) ? (:registerd) : (:activity) end

hth

ilan

thanks, i'll try that out.

fingers crossed.