Forum: Ruby on Rails Pass variables inside the page

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D38ed82faa0b3296a56c0f768f32ce57?d=identicon&s=25 Enzo Rivello (enzor)
on 2009-02-12 13:40
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-02-12 14:16
(Received via mailing list)
On 12 Feb 2009, at 12:40, Enzo Rivello 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
D38ed82faa0b3296a56c0f768f32ce57?d=identicon&s=25 Enzo Rivello (enzor)
on 2009-02-12 14:17
Frederick Cheung wrote:
> On 12 Feb 2009, at 12:40, Enzo Rivello 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
Ca0d1fa83b8d8f39a51c0f25b0f17336?d=identicon&s=25 Mathieu Rousseau (Guest)
on 2009-02-12 14:19
(Received via mailing list)
That's pure JS then.

onChange(this), and treat it accordingly...


On Thu, Feb 12, 2009 at 11:17 AM, Enzo Rivello <
Ca0d1fa83b8d8f39a51c0f25b0f17336?d=identicon&s=25 Mathieu Rousseau (Guest)
on 2009-02-12 14:20
(Received via mailing list)
oops.
onChange(yourFunction(this));

On Thu, Feb 12, 2009 at 11:18 AM, Mathieu Rousseau <
D38ed82faa0b3296a56c0f768f32ce57?d=identicon&s=25 Enzo Rivello (enzor)
on 2009-02-12 14:27
Mathieu Rousseau wrote:
> That's pure JS then.
>
> onChange(this), and treat it accordingly...
>
>
> On Thu, Feb 12, 2009 at 11:17 AM, Enzo Rivello <

and trough server side, how would it be?
Ca0d1fa83b8d8f39a51c0f25b0f17336?d=identicon&s=25 Mathieu Rousseau (Guest)
on 2009-02-12 14:32
(Received via mailing list)
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 Rivello <
D38ed82faa0b3296a56c0f768f32ce57?d=identicon&s=25 Enzo Rivello (enzor)
on 2009-02-12 17:56
Mathieu Rousseau 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 Rivello <

thanx a lot i resolved the problem with a classic form!
thank you!
This topic is locked and can not be replied to.