Hi I have the field Category, SubCategory, and ProductType in select boxes When a category is selected corresponding subcategory is selected and its corresponding product type is to be selected..But i have when a category selected subcategory selected and its produt type selecetd for first time..But after observerfield update div as follow my product type not updated code as below Category <%= select( "sd_ticket", "service_desk_category_id", ServiceDeskCategory.find(:all).collect {|p| [ p.name, p.id ] }) %> Subcategory <div id = "sub_category_container"><%= select( "sd_ticket", "service_desk_sub_category_id", ServiceDeskSubCategory.find(:all, :conditions => ["service_desk_category_id =?", 1] ).collect {|p| [ p.name, p.id ] }) %> </div> <%= observe_field("sd_ticket_service_desk_category_id", :update => "sub_category_container", :url => { :controller => :popup, :action => :prepare_sub_category }, :method => "post", :with => "''category_id=''+value") %> Product type <div id = "product_type_container"><%= select( "sd_ticket", "service_desk_product_type_id", ServiceDeskProductType.find(:all, :conditions => ["service_desk_sub_category_id =?", 1] ).collect {|p| [ p.name, p.id ] }) %></div> <%= observe_field("sd_ticket_service_desk_sub_category_id", :update => "product_type_container", :url => { :controller => :popup, :action => :prepare_product_type }, :method => "post", :with => "''sub_category_id=''+value") %> In the controller with rjsthe div is replaced with same code Please help Sijo -- Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi I could not solve this yet..When I click on the sub category select box corresponding product types are listed on Product type select box..But when I click on the ategory select box corresponding Subcategory are selected in the subcategory select boxe But then its product types are not filled in ProductType select box...How can I solve this..Please help Sijo -- Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 25 Jun 2008, at 06:23, Sijo Kg wrote:> > Hi > I could not solve this yet..When I click on the sub category select > box corresponding product types are listed on Product type select > box..But when I click on the ategory select box corresponding > Subcategory are selected in the subcategory select boxe But then its > product types are not filled in ProductType select box...How can I > solve > this..Please helpIt''s probably to do with the observer still observing the ''old'' select box that you have since replaced. You can probably make your life easier by using an onselect rather than the whole observe_field thing. Fred> > > Sijo > -- > Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Thanks for your eply..Could you please explain little bit more.I did not understand . Sijo -- Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 25 Jun 2008, at 10:02, Sijo Kg wrote:> > Hi > Thanks for your eply..Could you please explain little bit more.I did > not understand . >I''m speculating that the observe_field is still observing the replaced select, not it''s replacement and saying that you could use an onchange instead of an observer Fred> Sijo > -- > Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi I am solving as you said.Only one more thing to solve.I have two js function like function set_sub_category(val) { new Ajax.Updater(''sub_category_container'', ''/popup/prepare_sub_category'', { parameters: { category_id: val}, onSuccess: javascript:set_product_type(5); }); } function set_product_type(val) { alert(val); new Ajax.Updater(''product_type_container'', ''/popup/prepare_product_type'', { parameters: { sub_category_id: val} }); } Here how can I call set_product_type function onSuccess of set_sub_category?Also how can i return value from /popup/prepare_sub_category action to set_sub_category? Thanks in advance Sijo -- Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 25 Jun 2008, at 12:52, Sijo Kg wrote:> > Hi > I am solving as you said.Only one more thing to solve.I have two js > function like > > function set_sub_category(val) > { > new Ajax.Updater(''sub_category_container'', > ''/popup/prepare_sub_category'', { > parameters: { category_id: val}, > onSuccess: javascript:set_product_type(5); > }); > }That''s not syntactically correct: the parameter to onSuccess should be a function , eg onSuccess: function(response){set_product_type(5)} The response rendered by the server is available as response.responseText. Fred> function set_product_type(val) > { > alert(val); > new Ajax.Updater(''product_type_container'', > ''/popup/prepare_product_type'', { > parameters: { sub_category_id: val} > }); > } > > Here how can I call set_product_type function onSuccess of > set_sub_category?Also how can i return value from > /popup/prepare_sub_category action to set_sub_category? > > Thanks in advance > Sijo > -- > Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Thanks Its working..May I ask you one more?.Here I am just blindly passing 5 to set_product_type..Actually it is the service_desk_sub_category_id..How can I access this from response? Sijo -- Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 25, 1:13 pm, Sijo Kg <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi > Thanks Its working..May I ask you one more?.Here I am just blindly > passing 5 to set_product_type..Actually it is the > service_desk_sub_category_id..How can I access this from response? >$F(''service_desk_sub_category_id'') assuming you mean the value of the input item with that id Fred> Sijo > -- > Posted viahttp://www.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here when I gave onSuccess: function(response){javascript:alert(response.responseText) I get <select id="sd_ticket_service_desk_sub_category_id" name="sd_ticket[service_desk_sub_category_id]" onchange="javascript:set_product_type(this.value);" <option value="9">Category4-1</option> <option value="10">Category4-2</option> <option value="10">Category4-3</option> </select> How can I access the value 9 (which is what I need in this case)..That solves my problem Thanks in advance Sijo -- Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 25 Jun 2008, at 13:31, Sijo Kg wrote:> > Here when I gave > onSuccess: function(response){javascript:alert(response.responseText) >stop sticking in those javascript: things, theu''re completely superfluous at the best of times and syntatically invalid in the one above. Also, why bother messing around with the ajax response when you can just look at the form element? ($F(''sd_ticket_service_desk_sub_category_id'')) Fred> I get > <select id="sd_ticket_service_desk_sub_category_id" > name="sd_ticket[service_desk_sub_category_id]" > onchange="javascript:set_product_type(this.value);" > <option value="9">Category4-1</option> > <option value="10">Category4-2</option> > <option value="10">Category4-3</option> </select> > > How can I access the value 9 (which is what I need in this case)..That > solves my problem > > Thanks in advance > Sijo > -- > Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Fred Thanks a lot for helping me to solve this problem..For the last two days I was struggling with this ..Thanks again Sijo -- Posted via http://www.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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---