modal dialog box

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

modal dialog box

Joe Guerra
HI, I'd like to insert a bootstrap modal dialog box between my add to cart button and the actual action.

I know how to display the dialog box, but not sure how to hook it up to the form cart button?  [and the actual saving to cart]

Any suggestions?
Thanks,
Joe

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cc801572-b58e-4408-8678-bab4f90dfdf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: modal dialog box

Walter Lee Davis
Do you have multiple buttons on the page, each referring to a different product, and do you intend them to all go "through" a single modal? You're going to need to add some JavaScript to the mix, I imagine. Put a generic form in the modal itself, and then use data-attributes or a querystring to "tell" the modal which product is being ordered. You'll have to use JS to change the form element that signals what product is being ordered. Once you get through that, the rest is a normal CRUD Rails form.

Walter

> On Oct 19, 2018, at 9:14 AM, Joe Guerra <[hidden email]> wrote:
>
> HI, I'd like to insert a bootstrap modal dialog box between my add to cart button and the actual action.
>
> I know how to display the dialog box, but not sure how to hook it up to the form cart button?  [and the actual saving to cart]
>
> Any suggestions?
> Thanks,
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cc801572-b58e-4408-8678-bab4f90dfdf9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4CD81F71-6899-4B91-8111-FEBF0C843A3B%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: modal dialog box

Joe Guerra
No, I have an add to cart button, and I'd like them to confirm their action with a modal dialog box and if yes - save the record to the table, if no- do nothing.

[and I can also use the dialog to display some info].

On Saturday, October 20, 2018 at 8:13:08 AM UTC-4, Walter Lee Davis wrote:
Do you have multiple buttons on the page, each referring to a different product, and do you intend them to all go "through" a single modal? You're going to need to add some JavaScript to the mix, I imagine. Put a generic form in the modal itself, and then use data-attributes or a querystring to "tell" the modal which product is being ordered. You'll have to use JS to change the form element that signals what product is being ordered. Once you get through that, the rest is a normal CRUD Rails form.

Walter

> On Oct 19, 2018, at 9:14 AM, Joe Guerra <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="kC9x3B4zCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jgu...@...> wrote:
>
> HI, I'd like to insert a bootstrap modal dialog box between my add to cart button and the actual action.
>
> I know how to display the dialog box, but not sure how to hook it up to the form cart button?  [and the actual saving to cart]
>
> Any suggestions?
> Thanks,
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="kC9x3B4zCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="kC9x3B4zCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/cc801572-b58e-4408-8678-bab4f90dfdf9%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/cc801572-b58e-4408-8678-bab4f90dfdf9%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/cc801572-b58e-4408-8678-bab4f90dfdf9%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/cc801572-b58e-4408-8678-bab4f90dfdf9%40googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d097fd73-ef1e-47bb-8da5-b7bd8128f872%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: modal dialog box

Greg Navis
You can pre-render the modal with a confirmation form. When clicking "Add to cart" you can update the form with the ID of the product being added and show the modal. When the user submits the form it'll send the right product ID to the server.

Best
Greg

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAA6WWt9KNafGFnyWwq%3D-C5DN0cMBopOOzeXR3WZJYz8tap66ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: modal dialog box

Joe Guerra

Capture.PNG


Ok, this is what I have so far.  I've added the bootstrap modal and put the button right next to the actual button.  So, I need to render this modal, and then on the modal boxes save changes (update the cart).  
oh, the other thing I couldn't figure out is how to get the :qty from the form input field.  I need to check this value compare it to the remaining as well.

Thanks,
Joe


On Saturday, October 20, 2018 at 2:58:25 PM UTC-4, Greg Navis wrote:
You can pre-render the modal with a confirmation form. When clicking "Add to cart" you can update the form with the ID of the product being added and show the modal. When the user submits the form it'll send the right product ID to the server.

Best
Greg

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ccde906e-7ae7-4b12-b818-a58828f5c94d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: modal dialog box

Joe Guerra
In reply to this post by Greg Navis





Capture.PNG


Ok, this is what I have so far.  I've added the bootstrap modal and put the button right next to the actual button.  So, I need to render this modal, and then on the modal boxes save changes (update the cart).  
oh, the other thing I couldn't figure out is how to get the :qty from the form input field.  I need to check this value compare it to the remaining as well.


Thanks,
Joe

On Saturday, October 20, 2018 at 2:58:25 PM UTC-4, Greg Navis wrote:
You can pre-render the modal with a confirmation form. When clicking "Add to cart" you can update the form with the ID of the product being added and show the modal. When the user submits the form it'll send the right product ID to the server.

Best
Greg

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9326f448-1185-4afa-96c3-e475aa527751%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: modal dialog box

Walter Lee Davis
You could just make the regular button show a confirmation dialog in the usual Rails way

data: { confirm: "Are you sure you want to add #{@product.name} to your cart?" }

Then there are any number of Bootstrap plug-ins that hijack a normal JS confirm dialog (which is what the above creates) and style it as a BS modal. That way your form (including the quantity field) submits normally, and the Dootstrap part just decorates the result of a confirm() dialog in JS.

Walter

> On Oct 23, 2018, at 11:19 AM, Joe Guerra <[hidden email]> wrote:
>
>
>
>
>
>
> <Capture.PNG>
>
>
>
>
> Ok, this is what I have so far.  I've added the bootstrap modal and put the button right next to the actual button.  So, I need to render this modal, and then on the modal boxes save changes (update the cart).  
> oh, the other thing I couldn't figure out is how to get the :qty from the form input field.  I need to check this value compare it to the remaining as well.
>
>
> Thanks,
> Joe
>
> On Saturday, October 20, 2018 at 2:58:25 PM UTC-4, Greg Navis wrote:
> You can pre-render the modal with a confirmation form. When clicking "Add to cart" you can update the form with the ID of the product being added and show the modal. When the user submits the form it'll send the right product ID to the server.
>
> Best
> Greg
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9326f448-1185-4afa-96c3-e475aa527751%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <Capture.PNG>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6C95A2CB-9051-47A9-9DF3-2D65E26EF51D%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: modal dialog box

Joe Guerra
yes, that's what I ended up doing.  Removed the modal, and used the built-in submit tag confirmation.
It will have to do.

On Tue, Oct 23, 2018 at 11:56 AM Walter Lee Davis <[hidden email]> wrote:
You could just make the regular button show a confirmation dialog in the usual Rails way

data: { confirm: "Are you sure you want to add #{@product.name} to your cart?" }

Then there are any number of Bootstrap plug-ins that hijack a normal JS confirm dialog (which is what the above creates) and style it as a BS modal. That way your form (including the quantity field) submits normally, and the Dootstrap part just decorates the result of a confirm() dialog in JS.

Walter

> On Oct 23, 2018, at 11:19 AM, Joe Guerra <[hidden email]> wrote:
>
>
>
>
>
>
> <Capture.PNG>
>
>
>
>
> Ok, this is what I have so far.  I've added the bootstrap modal and put the button right next to the actual button.  So, I need to render this modal, and then on the modal boxes save changes (update the cart). 
> oh, the other thing I couldn't figure out is how to get the :qty from the form input field.  I need to check this value compare it to the remaining as well.
>
>
> Thanks,
> Joe
>
> On Saturday, October 20, 2018 at 2:58:25 PM UTC-4, Greg Navis wrote:
> You can pre-render the modal with a confirmation form. When clicking "Add to cart" you can update the form with the ID of the product being added and show the modal. When the user submits the form it'll send the right product ID to the server.
>
> Best
> Greg
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9326f448-1185-4afa-96c3-e475aa527751%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <Capture.PNG>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6C95A2CB-9051-47A9-9DF3-2D65E26EF51D%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmnOqyZ2histpQ2QfRG-vLVD%3DLiJ7cPtcwXeEkRuqsE9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.