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 -- Posted via ruby-forum.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12 Feb 2009, at 12:40, Enzo Rivello wrote:> > 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? >is this entirely client side or do you want to make an ajax request ? Fred> thanx in advance > > > enzo rivello > -- > Posted via ruby-forum.com. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 ? > > Fredif possible only on client side -- Posted via ruby-forum.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That''s pure JS then. onChange(this), and treat it accordingly... On Thu, Feb 12, 2009 at 11:17 AM, Enzo Rivello < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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 > -- > Posted via ruby-forum.com. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
oops. onChange(yourFunction(this)); On Thu, Feb 12, 2009 at 11:18 AM, Mathieu Rousseau < mathieu.rousseau.31-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That''s pure JS then. > > onChange(this), and treat it accordingly... > > > > On Thu, Feb 12, 2009 at 11:17 AM, Enzo Rivello < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> 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 >> -- >> Posted via ruby-forum.com. >> >> >> >> >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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? -- Posted via ruby-forum.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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? > -- > Posted via ruby-forum.com. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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! -- Posted via ruby-forum.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---