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.
Enzo R. (Guest)
on 2009-02-12 14: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
Frederick C. (Guest)
on 2009-02-12 15:16
(Received via mailing list)
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
Enzo R. (Guest)
on 2009-02-12 15:17
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
Mathieu R. (Guest)
on 2009-02-12 15: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 R. <
Mathieu R. (Guest)
on 2009-02-12 15:20
(Received via mailing list)
oops.
onChange(yourFunction(this));

On Thu, Feb 12, 2009 at 11:18 AM, Mathieu R. <
Enzo R. (Guest)
on 2009-02-12 15:27
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?
Mathieu R. (Guest)
on 2009-02-12 15: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 R. <
Enzo R. (Guest)
on 2009-02-12 18:56
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!
This topic is locked and can not be replied to.