Community Forums 

Main Content

Force selection with multiple items on page

    Oct 04 2012 17:50:55

    #1

    Claire

    Join date : 2008-11-08      Posts : 90

    Hello! I have done force selection for 1 item on a page. here's an example -- http://www.outdoortrailgear.com/co-op-details/test2.html

    and live sample http://www.outdoortrailgear.com/trail-gear-gallery/908-cook-pot/

    BUT.... Hoping someone might be able to answer a few questions;

    1. can force selection be done with multiple items on a page?

    2. If #1 is yes. Do the qty boxes have to be drop down type or can they be like this? http://www.outdoortrailgear.com/trail-gear-gallery/dutch-buckle/

    Thanks for any advice in advance!

    ----
    Claire Walters Design Studios




    Oct 04 2012 20:36:04

    #2

    Claire

    Join date : 2008-11-08      Posts : 90

    If force selection can work with multiple items on the page.

    my next question could I add script to keep the user on the page after adding an item to the cart? Thank you!

    ----
    Claire Walters Design Studios




    Oct 05 2012 06:30:37

    #3

    GT

    Join date : 2008-09-18      Posts : 3212

    In the script, you have these lines:

    if(F.elements["qty1"].options[F.elements["qty1"].options.selectedIndex].value == '')
    {
    result += warn[0];
    }

    if(F.elements["product1"].options[F.elements["product1"].options.selectedIndex].value == '')
    {
    result += warn[1];
    }

    ***********************
    If you wish to use other products on the same page using the same form, then simply add to the script:

    if(F.elements["qty2"].options[F.elements["qty2"].options.selectedIndex].value == '')
    {
    result += warn[0];
    }

    if(F.elements["product2"].options[F.elements["product2"].options.selectedIndex].value == '')
    {
    result += warn[1];
    }

    etc
    etc

    I'm not sure why you would want to keep the buyer on the same page after they had made all of their chosen selections, but if you do, you could use this:
    http://www.malsforms.com/send-to-cart.html

    Having trouble with a form or need one building?
    Fast turnaround, but I do charge :)

    Mal's Forms / Scripts and the syntax are here.




    Oct 05 2012 15:42:53

    #4

    Claire

    Join date : 2008-11-08      Posts : 90

    Thank you GT - going to go give it a try now.

    Agree - keeping user on page after adding an item to cart dosn't always make sense.

    Will report back later - hopefully sooner than later ;)

    Much appreciated!



    GT said In the script, you have these lines:

    if(F.elements["qty1"].options[F.elements["qty1"].options.selectedIndex].value == '')
    {
    result += warn[0];
    }

    if(F.elements["product1"].options[F.elements["product1"].options.selectedIndex].value == '')
    {
    result += warn[1];
    }

    ***********************
    If you wish to use other products on the same page using the same form, then simply add to the script:

    if(F.elements["qty2"].options[F.elements["qty2"].options.selectedIndex].value == '')
    {
    result += warn[0];
    }

    if(F.elements["product2"].options[F.elements["product2"].options.selectedIndex].value == '')
    {
    result += warn[1];
    }

    etc
    etc

    I'm not sure why you would want to keep the buyer on the same page after they had made all of their chosen selections, but if you do, you could use this:
    http://www.malsforms.com/send-to-cart.html

    ----
    Claire Walters Design Studios




    Oct 05 2012 16:45:23

    #5

    Claire

    Join date : 2008-11-08      Posts : 90

    Here's a follow-up sample to force selection with multiple items on page. The key was to make qty box drop down where you want force selection function

    http://www.outdoortrailgear.com/co-op-details/dutch-buckle.html

    Will leave that on my server if anyone wants to use for sample.

    Thx again GT! :)

    ----
    Claire Walters Design Studios




    Oct 06 2012 06:32:45

    #6

    GT

    Join date : 2008-09-18      Posts : 3212

    I replied to Claire as she messaged me.

    Having trouble with a form or need one building?
    Fast turnaround, but I do charge :)

    Mal's Forms / Scripts and the syntax are here.