rubyrails9
2012-Aug-10 08:48 UTC
submit() not working on first click....it is working on second click
I am developing an e-commerce site.. and now I got stuck at one point.. When I submit the form ,it doesn''t submits on the *first click*, and i need to give a second click to get it working... I have used anchor tag to submit my data bcoz I want to show the data inside thickbox(iframe)... View file <%= form_for :order, :url => populate_orders_url ,:html => { :class => "data# product.id}"},:method => "post",:remote => true do |f| %> // data //submit button <a href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" class="thickbox cart_button"></a> orders controller.rb def populate @order = current_order(true) params[:products].each do |product_id,variant_id| quantity = params[:quantity].to_i if !params[:quantity].is_a?(Hash) quantity = params[:quantity][variant_id].to_i if params[:quantity].is_a?(Hash) @order.add_variant(Variant.find(variant_id), quantity, ad_hoc_option_value_ids, product_customizations) if quantity > 0 end if params[:products] params[:variants].each do |variant_id, quantity| quantity = quantity.to_i @order.add_variant(Variant.find(variant_id), quantity, ad_hoc_option_value_ids, product_customizations) if quantity > 0 end if params[:variants] fire_event(''spree.cart.add'') fire_event(''spree.order.contents_changed'') redirect_to cart end I have seen in firebug and populate method is processed but it not sending data into cart and it showing me empty cart..and cart is processing... Please help...!! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2012-Aug-10 09:25 UTC
Re: submit() not working on first click....it is working on second click
On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am developing an e-commerce site.. and now I got stuck at one point.. When > I submit the form ,it doesn''t submits on the first click, and i need to give > a second click to get it working... I have used anchor tag to submit my data > bcoz I want to show the data inside thickbox(iframe)... > > View file > <%= form_for :order, :url => populate_orders_url ,:html => { :class => > "data# product.id}"},:method => "post",:remote => true do |f| %> > > > // data > //submit button > > > <a > href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" > class="thickbox cart_button"></a> > > > orders controller.rb > def populate > @order = current_order(true) > > > params[:products].each do |product_id,variant_id| > > quantity = params[:quantity].to_i if !params[:quantity].is_a?(Hash) > > quantity = params[:quantity][variant_id].to_i if > params[:quantity].is_a?(Hash) > > @order.add_variant(Variant.find(variant_id), quantity, > ad_hoc_option_value_ids, product_customizations) if quantity > 0 > > end if params[:products] > > > params[:variants].each do |variant_id, quantity| > > quantity = quantity.to_i > @order.add_variant(Variant.find(variant_id), quantity, > ad_hoc_option_value_ids, product_customizations) if quantity > 0 > > end if params[:variants] > > > fire_event(''spree.cart.add'') > fire_event(''spree.order.contents_changed'') > > > redirect_to cart > > end > > I have seen in firebug and populate method is processed but it not sending > data into cart and it showing me empty cart..and cart is processing... >Have a look in development.log and see what is added when you click it the first time. You will see what action, if any, is run. Then have a look at the Rails Guide on Debugging to see methods that are useful for debugging the code. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
rubyrails9
2012-Aug-10 10:24 UTC
Re: submit() not working on first click....it is working on second click
that all I have done...I am not getting anything in development log.... Any other suggestion?? On Fri, Aug 10, 2012 at 2:55 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I am developing an e-commerce site.. and now I got stuck at one point.. > When > > I submit the form ,it doesn''t submits on the first click, and i need to > give > > a second click to get it working... I have used anchor tag to submit my > data > > bcoz I want to show the data inside thickbox(iframe)... > > > > View file > > <%= form_for :order, :url => populate_orders_url ,:html => { :class => > > "data# product.id}"},:method => "post",:remote => true do |f| %> > > > > > > // data > > //submit button > > > > > > <a > > > href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" > > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" > > class="thickbox cart_button"></a> > > > > > > orders controller.rb > > def populate > > @order = current_order(true) > > > > > > params[:products].each do |product_id,variant_id| > > > > quantity = params[:quantity].to_i if !params[:quantity].is_a?(Hash) > > > > quantity = params[:quantity][variant_id].to_i if > > params[:quantity].is_a?(Hash) > > > > @order.add_variant(Variant.find(variant_id), quantity, > > ad_hoc_option_value_ids, product_customizations) if quantity > 0 > > > > end if params[:products] > > > > > > params[:variants].each do |variant_id, quantity| > > > > quantity = quantity.to_i > > @order.add_variant(Variant.find(variant_id), quantity, > > ad_hoc_option_value_ids, product_customizations) if quantity > 0 > > > > end if params[:variants] > > > > > > fire_event(''spree.cart.add'') > > fire_event(''spree.order.contents_changed'') > > > > > > redirect_to cart > > > > end > > > > I have seen in firebug and populate method is processed but it not > sending > > data into cart and it showing me empty cart..and cart is processing... > > > > Have a look in development.log and see what is added when you click it > the first time. You will see what action, if any, is run. Then have > a look at the Rails Guide on Debugging to see methods that are useful > for debugging the code. > > Colin > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
rubyrails9
2012-Aug-10 10:26 UTC
Re: submit() not working on first click....it is working on second click
I mean, product id is passed... but its not showing me cart page... On Fri, Aug 10, 2012 at 3:54 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> that all I have done...I am not getting anything in development log.... > Any other suggestion?? > > > On Fri, Aug 10, 2012 at 2:55 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > I am developing an e-commerce site.. and now I got stuck at one point.. >> When >> > I submit the form ,it doesn''t submits on the first click, and i need to >> give >> > a second click to get it working... I have used anchor tag to submit my >> data >> > bcoz I want to show the data inside thickbox(iframe)... >> > >> > View file >> > <%= form_for :order, :url => populate_orders_url ,:html => { :class => >> > "data# product.id}"},:method => "post",:remote => true do |f| %> >> > >> > >> > // data >> > //submit button >> > >> > >> > <a >> > >> href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" >> > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" >> > class="thickbox cart_button"></a> >> > >> > >> > orders controller.rb >> > def populate >> > @order = current_order(true) >> > >> > >> > params[:products].each do |product_id,variant_id| >> > >> > quantity = params[:quantity].to_i if !params[:quantity].is_a?(Hash) >> > >> > quantity = params[:quantity][variant_id].to_i if >> > params[:quantity].is_a?(Hash) >> > >> > @order.add_variant(Variant.find(variant_id), quantity, >> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >> > >> > end if params[:products] >> > >> > >> > params[:variants].each do |variant_id, quantity| >> > >> > quantity = quantity.to_i >> > @order.add_variant(Variant.find(variant_id), quantity, >> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >> > >> > end if params[:variants] >> > >> > >> > fire_event(''spree.cart.add'') >> > fire_event(''spree.order.contents_changed'') >> > >> > >> > redirect_to cart >> > >> > end >> > >> > I have seen in firebug and populate method is processed but it not >> sending >> > data into cart and it showing me empty cart..and cart is processing... >> > >> >> Have a look in development.log and see what is added when you click it >> the first time. You will see what action, if any, is run. Then have >> a look at the Rails Guide on Debugging to see methods that are useful >> for debugging the code. >> >> Colin >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2012-Aug-10 10:48 UTC
Re: submit() not working on first click....it is working on second click
On 10 August 2012 11:26, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I mean, product id is passed... but its not showing me cart page...So when you click the button the first time you see it calling an action in the log, but that action is not doing what you expect? In that case, as I said before, have a look at the Rails Guide on debugging to find how to debug the code. Put debug display code in the action or use the debugger to find why it is going wrong. Colin> > > On Fri, Aug 10, 2012 at 3:54 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> that all I have done...I am not getting anything in development log.... >> Any other suggestion?? >> >> >> On Fri, Aug 10, 2012 at 2:55 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >>> >>> On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > I am developing an e-commerce site.. and now I got stuck at one point.. >>> > When >>> > I submit the form ,it doesn''t submits on the first click, and i need to >>> > give >>> > a second click to get it working... I have used anchor tag to submit my >>> > data >>> > bcoz I want to show the data inside thickbox(iframe)... >>> > >>> > View file >>> > <%= form_for :order, :url => populate_orders_url ,:html => { :class >>> > => >>> > "data# product.id}"},:method => "post",:remote => true do |f| %> >>> > >>> > >>> > // data >>> > //submit button >>> > >>> > >>> > <a >>> > >>> > href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" >>> > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" >>> > class="thickbox cart_button"></a> >>> > >>> > >>> > orders controller.rb >>> > def populate >>> > @order = current_order(true) >>> > >>> > >>> > params[:products].each do |product_id,variant_id| >>> > >>> > quantity = params[:quantity].to_i if !params[:quantity].is_a?(Hash) >>> > >>> > quantity = params[:quantity][variant_id].to_i if >>> > params[:quantity].is_a?(Hash) >>> > >>> > @order.add_variant(Variant.find(variant_id), quantity, >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >>> > >>> > end if params[:products] >>> > >>> > >>> > params[:variants].each do |variant_id, quantity| >>> > >>> > quantity = quantity.to_i >>> > @order.add_variant(Variant.find(variant_id), quantity, >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >>> > >>> > end if params[:variants] >>> > >>> > >>> > fire_event(''spree.cart.add'') >>> > fire_event(''spree.order.contents_changed'') >>> > >>> > >>> > redirect_to cart >>> > >>> > end >>> > >>> > I have seen in firebug and populate method is processed but it not >>> > sending >>> > data into cart and it showing me empty cart..and cart is processing... >>> > >>> >>> Have a look in development.log and see what is added when you click it >>> the first time. You will see what action, if any, is run. Then have >>> a look at the Rails Guide on Debugging to see methods that are useful >>> for debugging the code. >>> >>> Colin >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
rubyrails9
2012-Aug-10 12:29 UTC
Re: submit() not working on first click....it is working on second click
Actually I have now install foot note gem in my development mode.... Here what I am getting is that, data is inserted into cart, but it is not showing me in thick box (*localhost:3000*) as my thick box pop-ups at my home page... It is showing me in *localhost:3000/cart*... Its actual link... <a *href**="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false"* onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" class="thickbox cart_button"></a> problem lies here... but whats other alternative... I have used link_to tag... ?? On Fri, Aug 10, 2012 at 4:18 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 10 August 2012 11:26, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I mean, product id is passed... but its not showing me cart page... > > So when you click the button the first time you see it calling an > action in the log, but that action is not doing what you expect? In > that case, as I said before, have a look at the Rails Guide on > debugging to find how to debug the code. Put debug display code in > the action or use the debugger to find why it is going wrong. > > Colin > > > > > > On Fri, Aug 10, 2012 at 3:54 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> > >> that all I have done...I am not getting anything in development log.... > >> Any other suggestion?? > >> > >> > >> On Fri, Aug 10, 2012 at 2:55 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >>> > >>> On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>> > I am developing an e-commerce site.. and now I got stuck at one > point.. > >>> > When > >>> > I submit the form ,it doesn''t submits on the first click, and i need > to > >>> > give > >>> > a second click to get it working... I have used anchor tag to submit > my > >>> > data > >>> > bcoz I want to show the data inside thickbox(iframe)... > >>> > > >>> > View file > >>> > <%= form_for :order, :url => populate_orders_url ,:html => { :class > >>> > => > >>> > "data# product.id}"},:method => "post",:remote => true do |f| %> > >>> > > >>> > > >>> > // data > >>> > //submit button > >>> > > >>> > > >>> > <a > >>> > > >>> > > href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" > >>> > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" > >>> > class="thickbox cart_button"></a> > >>> > > >>> > > >>> > orders controller.rb > >>> > def populate > >>> > @order = current_order(true) > >>> > > >>> > > >>> > params[:products].each do |product_id,variant_id| > >>> > > >>> > quantity = params[:quantity].to_i if > !params[:quantity].is_a?(Hash) > >>> > > >>> > quantity = params[:quantity][variant_id].to_i if > >>> > params[:quantity].is_a?(Hash) > >>> > > >>> > @order.add_variant(Variant.find(variant_id), quantity, > >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 > >>> > > >>> > end if params[:products] > >>> > > >>> > > >>> > params[:variants].each do |variant_id, quantity| > >>> > > >>> > quantity = quantity.to_i > >>> > @order.add_variant(Variant.find(variant_id), quantity, > >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 > >>> > > >>> > end if params[:variants] > >>> > > >>> > > >>> > fire_event(''spree.cart.add'') > >>> > fire_event(''spree.order.contents_changed'') > >>> > > >>> > > >>> > redirect_to cart > >>> > > >>> > end > >>> > > >>> > I have seen in firebug and populate method is processed but it not > >>> > sending > >>> > data into cart and it showing me empty cart..and cart is > processing... > >>> > > >>> > >>> Have a look in development.log and see what is added when you click it > >>> the first time. You will see what action, if any, is run. Then have > >>> a look at the Rails Guide on Debugging to see methods that are useful > >>> for debugging the code. > >>> > >>> Colin > >>> > >>> -- > >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >>> For more options, visit https://groups.google.com/groups/opt_out. > >>> > >>> > >> > > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
rubyrails9
2012-Aug-10 12:30 UTC
Re: submit() not working on first click....it is working on second click
I have used link_to tag already.... and button tag also... my major requirement is that I need to show them in thickbox... On Fri, Aug 10, 2012 at 5:59 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Actually I have now install foot note gem in my development mode.... Here > what I am getting is that, data is inserted into cart, but it is not > showing me in thick box (*localhost:3000*) as my thick box pop-ups at my > home page... It is showing me in *localhost:3000/cart*... Its actual > link... > > <a *href**="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false"* onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" class="thickbox cart_button"></a> > > problem lies here... but whats other alternative... I have used link_to > tag... ?? > > > > > On Fri, Aug 10, 2012 at 4:18 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 10 August 2012 11:26, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > I mean, product id is passed... but its not showing me cart page... >> >> So when you click the button the first time you see it calling an >> action in the log, but that action is not doing what you expect? In >> that case, as I said before, have a look at the Rails Guide on >> debugging to find how to debug the code. Put debug display code in >> the action or use the debugger to find why it is going wrong. >> >> Colin >> > >> > >> > On Fri, Aug 10, 2012 at 3:54 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >> >> >> >> that all I have done...I am not getting anything in development log.... >> >> Any other suggestion?? >> >> >> >> >> >> On Fri, Aug 10, 2012 at 2:55 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >> wrote: >> >>> >> >>> On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> > I am developing an e-commerce site.. and now I got stuck at one >> point.. >> >>> > When >> >>> > I submit the form ,it doesn''t submits on the first click, and i >> need to >> >>> > give >> >>> > a second click to get it working... I have used anchor tag to >> submit my >> >>> > data >> >>> > bcoz I want to show the data inside thickbox(iframe)... >> >>> > >> >>> > View file >> >>> > <%= form_for :order, :url => populate_orders_url ,:html => { >> :class >> >>> > => >> >>> > "data# product.id}"},:method => "post",:remote => true do |f| %> >> >>> > >> >>> > >> >>> > // data >> >>> > //submit button >> >>> > >> >>> > >> >>> > <a >> >>> > >> >>> > >> href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" >> >>> > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" >> >>> > class="thickbox cart_button"></a> >> >>> > >> >>> > >> >>> > orders controller.rb >> >>> > def populate >> >>> > @order = current_order(true) >> >>> > >> >>> > >> >>> > params[:products].each do |product_id,variant_id| >> >>> > >> >>> > quantity = params[:quantity].to_i if >> !params[:quantity].is_a?(Hash) >> >>> > >> >>> > quantity = params[:quantity][variant_id].to_i if >> >>> > params[:quantity].is_a?(Hash) >> >>> > >> >>> > @order.add_variant(Variant.find(variant_id), quantity, >> >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >> >>> > >> >>> > end if params[:products] >> >>> > >> >>> > >> >>> > params[:variants].each do |variant_id, quantity| >> >>> > >> >>> > quantity = quantity.to_i >> >>> > @order.add_variant(Variant.find(variant_id), quantity, >> >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >> >>> > >> >>> > end if params[:variants] >> >>> > >> >>> > >> >>> > fire_event(''spree.cart.add'') >> >>> > fire_event(''spree.order.contents_changed'') >> >>> > >> >>> > >> >>> > redirect_to cart >> >>> > >> >>> > end >> >>> > >> >>> > I have seen in firebug and populate method is processed but it not >> >>> > sending >> >>> > data into cart and it showing me empty cart..and cart is >> processing... >> >>> > >> >>> >> >>> Have a look in development.log and see what is added when you click it >> >>> the first time. You will see what action, if any, is run. Then have >> >>> a look at the Rails Guide on Debugging to see methods that are useful >> >>> for debugging the code. >> >>> >> >>> Colin >> >>> >> >>> -- >> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >>> To unsubscribe from this group, send email to >> >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >>> For more options, visit https://groups.google.com/groups/opt_out. >> >>> >> >>> >> >> >> > >> > -- >> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To unsubscribe from this group, send email to >> > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
rubyrails9
2012-Aug-10 12:37 UTC
Re: submit() not working on first click....it is working on second click
can I reload thickbox automatically????? On Fri, Aug 10, 2012 at 6:00 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have used link_to tag already.... and button tag also... my major > requirement is that I need to show them in thickbox... > > > On Fri, Aug 10, 2012 at 5:59 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Actually I have now install foot note gem in my development mode.... Here >> what I am getting is that, data is inserted into cart, but it is not >> showing me in thick box (*localhost:3000*) as my thick box pop-ups at my >> home page... It is showing me in *localhost:3000/cart*... Its actual >> link... >> >> <a *href**="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false"* onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" class="thickbox cart_button"></a> >> >> problem lies here... but whats other alternative... I have used link_to >> tag... ?? >> >> >> >> >> On Fri, Aug 10, 2012 at 4:18 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>wrote: >> >>> On 10 August 2012 11:26, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > I mean, product id is passed... but its not showing me cart page... >>> >>> So when you click the button the first time you see it calling an >>> action in the log, but that action is not doing what you expect? In >>> that case, as I said before, have a look at the Rails Guide on >>> debugging to find how to debug the code. Put debug display code in >>> the action or use the debugger to find why it is going wrong. >>> >>> Colin >>> > >>> > >>> > On Fri, Aug 10, 2012 at 3:54 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> wrote: >>> >> >>> >> that all I have done...I am not getting anything in development >>> log.... >>> >> Any other suggestion?? >>> >> >>> >> >>> >> On Fri, Aug 10, 2012 at 2:55 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >>> wrote: >>> >>> >>> >>> On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>> > I am developing an e-commerce site.. and now I got stuck at one >>> point.. >>> >>> > When >>> >>> > I submit the form ,it doesn''t submits on the first click, and i >>> need to >>> >>> > give >>> >>> > a second click to get it working... I have used anchor tag to >>> submit my >>> >>> > data >>> >>> > bcoz I want to show the data inside thickbox(iframe)... >>> >>> > >>> >>> > View file >>> >>> > <%= form_for :order, :url => populate_orders_url ,:html => { >>> :class >>> >>> > => >>> >>> > "data# product.id}"},:method => "post",:remote => true do |f| %> >>> >>> > >>> >>> > >>> >>> > // data >>> >>> > //submit button >>> >>> > >>> >>> > >>> >>> > <a >>> >>> > >>> >>> > >>> href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" >>> >>> > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" >>> >>> > class="thickbox cart_button"></a> >>> >>> > >>> >>> > >>> >>> > orders controller.rb >>> >>> > def populate >>> >>> > @order = current_order(true) >>> >>> > >>> >>> > >>> >>> > params[:products].each do |product_id,variant_id| >>> >>> > >>> >>> > quantity = params[:quantity].to_i if >>> !params[:quantity].is_a?(Hash) >>> >>> > >>> >>> > quantity = params[:quantity][variant_id].to_i if >>> >>> > params[:quantity].is_a?(Hash) >>> >>> > >>> >>> > @order.add_variant(Variant.find(variant_id), quantity, >>> >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >>> >>> > >>> >>> > end if params[:products] >>> >>> > >>> >>> > >>> >>> > params[:variants].each do |variant_id, quantity| >>> >>> > >>> >>> > quantity = quantity.to_i >>> >>> > @order.add_variant(Variant.find(variant_id), quantity, >>> >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >>> >>> > >>> >>> > end if params[:variants] >>> >>> > >>> >>> > >>> >>> > fire_event(''spree.cart.add'') >>> >>> > fire_event(''spree.order.contents_changed'') >>> >>> > >>> >>> > >>> >>> > redirect_to cart >>> >>> > >>> >>> > end >>> >>> > >>> >>> > I have seen in firebug and populate method is processed but it not >>> >>> > sending >>> >>> > data into cart and it showing me empty cart..and cart is >>> processing... >>> >>> > >>> >>> >>> >>> Have a look in development.log and see what is added when you click >>> it >>> >>> the first time. You will see what action, if any, is run. Then have >>> >>> a look at the Rails Guide on Debugging to see methods that are useful >>> >>> for debugging the code. >>> >>> >>> >>> Colin >>> >>> >>> >>> -- >>> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> >>> To unsubscribe from this group, send email to >>> >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >>> >>> >> >>> > >>> > -- >>> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> > For more options, visit https://groups.google.com/groups/opt_out. >>> > >>> > >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2012-Aug-10 12:44 UTC
Re: submit() not working on first click....it is working on second click
On 10 August 2012 13:37, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> can I reload thickbox automatically?????I have no idea even what thickbox is, sorry. Colin> > > On Fri, Aug 10, 2012 at 6:00 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> I have used link_to tag already.... and button tag also... my major >> requirement is that I need to show them in thickbox... >> >> >> On Fri, Aug 10, 2012 at 5:59 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>> Actually I have now install foot note gem in my development mode.... Here >>> what I am getting is that, data is inserted into cart, but it is not showing >>> me in thick box (localhost:3000) as my thick box pop-ups at my home page... >>> It is showing me in localhost:3000/cart... Its actual link... >>> >>> <a >>> href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" >>> onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" >>> class="thickbox cart_button"></a> >>> >>> >>> >>> problem lies here... but whats other alternative... I have used link_to >>> tag... ?? >>> >>> >>> >>> >>> On Fri, Aug 10, 2012 at 4:18 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >>> wrote: >>>> >>>> On 10 August 2012 11:26, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> > I mean, product id is passed... but its not showing me cart page... >>>> >>>> So when you click the button the first time you see it calling an >>>> action in the log, but that action is not doing what you expect? In >>>> that case, as I said before, have a look at the Rails Guide on >>>> debugging to find how to debug the code. Put debug display code in >>>> the action or use the debugger to find why it is going wrong. >>>> >>>> Colin >>>> > >>>> > >>>> > On Fri, Aug 10, 2012 at 3:54 PM, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>>> > wrote: >>>> >> >>>> >> that all I have done...I am not getting anything in development >>>> >> log.... >>>> >> Any other suggestion?? >>>> >> >>>> >> >>>> >> On Fri, Aug 10, 2012 at 2:55 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >>>> >> wrote: >>>> >>> >>>> >>> On 10 August 2012 09:48, rubyrails9 <rubyrails9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> >>> > I am developing an e-commerce site.. and now I got stuck at one >>>> >>> > point.. >>>> >>> > When >>>> >>> > I submit the form ,it doesn''t submits on the first click, and i >>>> >>> > need to >>>> >>> > give >>>> >>> > a second click to get it working... I have used anchor tag to >>>> >>> > submit my >>>> >>> > data >>>> >>> > bcoz I want to show the data inside thickbox(iframe)... >>>> >>> > >>>> >>> > View file >>>> >>> > <%= form_for :order, :url => populate_orders_url ,:html => { >>>> >>> > :class >>>> >>> > => >>>> >>> > "data# product.id}"},:method => "post",:remote => true do |f| %> >>>> >>> > >>>> >>> > >>>> >>> > // data >>>> >>> > //submit button >>>> >>> > >>>> >>> > >>>> >>> > <a >>>> >>> > >>>> >>> > >>>> >>> > href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false" >>>> >>> > onclick="$(''.data<%= product.id %>'').submit().trigger.reload();" >>>> >>> > class="thickbox cart_button"></a> >>>> >>> > >>>> >>> > >>>> >>> > orders controller.rb >>>> >>> > def populate >>>> >>> > @order = current_order(true) >>>> >>> > >>>> >>> > >>>> >>> > params[:products].each do |product_id,variant_id| >>>> >>> > >>>> >>> > quantity = params[:quantity].to_i if >>>> >>> > !params[:quantity].is_a?(Hash) >>>> >>> > >>>> >>> > quantity = params[:quantity][variant_id].to_i if >>>> >>> > params[:quantity].is_a?(Hash) >>>> >>> > >>>> >>> > @order.add_variant(Variant.find(variant_id), quantity, >>>> >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >>>> >>> > >>>> >>> > end if params[:products] >>>> >>> > >>>> >>> > >>>> >>> > params[:variants].each do |variant_id, quantity| >>>> >>> > >>>> >>> > quantity = quantity.to_i >>>> >>> > @order.add_variant(Variant.find(variant_id), quantity, >>>> >>> > ad_hoc_option_value_ids, product_customizations) if quantity > 0 >>>> >>> > >>>> >>> > end if params[:variants] >>>> >>> > >>>> >>> > >>>> >>> > fire_event(''spree.cart.add'') >>>> >>> > fire_event(''spree.order.contents_changed'') >>>> >>> > >>>> >>> > >>>> >>> > redirect_to cart >>>> >>> > >>>> >>> > end >>>> >>> > >>>> >>> > I have seen in firebug and populate method is processed but it not >>>> >>> > sending >>>> >>> > data into cart and it showing me empty cart..and cart is >>>> >>> > processing... >>>> >>> > >>>> >>> >>>> >>> Have a look in development.log and see what is added when you click >>>> >>> it >>>> >>> the first time. You will see what action, if any, is run. Then >>>> >>> have >>>> >>> a look at the Rails Guide on Debugging to see methods that are >>>> >>> useful >>>> >>> for debugging the code. >>>> >>> >>>> >>> Colin >>>> >>> >>>> >>> -- >>>> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> >>> To unsubscribe from this group, send email to >>>> >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>>> >>> >>>> >> >>>> > >>>> > -- >>>> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> > To unsubscribe from this group, send email to >>>> > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> > For more options, visit https://groups.google.com/groups/opt_out. >>>> > >>>> > >>>> >>>> -- >>>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To unsubscribe from this group, send email to >>>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>> >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.