Pass variables inside the page


#1

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


#2

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


#3

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


#4

That’s pure JS then.

onChange(this), and treat it accordingly…

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


#5

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?


#6

oops.
onChange(yourFunction(this));

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


#7

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!


#8

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. <