Pass variables inside the page

Hi!

I need to create a combobox which , depending on the selected value,
will display different items whithout reloading the page

<%= select(“product”,“choice”, Pricebooks.find(:all).collect { |p|
[p.name,p.id]}, {:selected => Pricebooks.find(:first)} , {onchange =>
???)%>

How can i retrieve the value of the selected product through onchange?

thanx in advance

enzo rivello

On 12 Feb 2009, at 12:40, Enzo R. wrote:

How can i retrieve the value of the selected product through onchange?

is this entirely client side or do you want to make an ajax request ?

Fred

Frederick C. wrote:

On 12 Feb 2009, at 12:40, Enzo R. wrote:

How can i retrieve the value of the selected product through onchange?

is this entirely client side or do you want to make an ajax request ?

Fred

if possible only on client side

That’s pure JS then.

onChange(this), and treat it accordingly…

On Thu, Feb 12, 2009 at 11:17 AM, Enzo R. <

Mathieu R. wrote:

That’s pure JS then.

onChange(this), and treat it accordingly…

On Thu, Feb 12, 2009 at 11:17 AM, Enzo R. <

and trough server side, how would it be?

oops.
onChange(yourFunction(this));

On Thu, Feb 12, 2009 at 11:18 AM, Mathieu R. <

Mathieu R. wrote:

well, you can submit a classic form request and reload the whole page,
or
submit an ajax request and then update just a part of your page. I think
that you should decide what you want do, then hack this solution. Not
decide
what you want to do because it seems simpler to do.

On Thu, Feb 12, 2009 at 11:27 AM, Enzo R. <

thanx a lot i resolved the problem with a classic form!
thank you!

well, you can submit a classic form request and reload the whole page,
or
submit an ajax request and then update just a part of your page. I think
that you should decide what you want do, then hack this solution. Not
decide
what you want to do because it seems simpler to do.

On Thu, Feb 12, 2009 at 11:27 AM, Enzo R. <