/    Sign up×
Community /Pin to ProfileBookmark

Need help will placing checkbox values to the end of url

Ok, here is my situation:

When the user chooses either 4×6 or 5×7 picture size they must select additional pictures via checkboxes (not a problem). After they have selected the additional pictures and press submit, all the information needs to be displayed in the shopping cart (problem). In order for the shopping cart to know what pictures were selected they need to be added to the end of the url [url]http://globalhopemarket.foxycart.com[/url].

I have the following script that gets the value of the selected checkboxes:

<script type=”text/javascript”>
<!–
function get_check_value()
{
var c_value = “”;
for (var i=0; i < document.orderform.picture.length; i++)
{
if (document.orderform.picture[i].checked)
{
c_value = c_value + document.orderform.picture[i].value + “n”;
}
}
}
//–>
</script>

My html page contains the following:

<form name=”packageform”>

<input type=”checkbox” value=”128″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”127″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”125″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”126″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”123″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”124″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”122″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”121″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”120″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”119″ name=”picture” class=”foxycart” />
<input type=”checkbox” value=”118″ name=”picture” class=”foxycart” />

<input type=”submit” class=”foxycart” onclick=”get_check_value()”/>
</form>

Currently, this is correctly adding the values of the selected checkboxes to the local url, but I need to specify the url to be [url]http://globalhopemarket.foxycart.com[/url] instead.

You can view the current page here: [url]http://my360lab.com/global/index.php?/site/producttest/courage/[/url] select the 5×7 option and the other pictures will slide down(its not pretty cause I’m still working on it).

To clarify, clicking submit currently sends you to [url]http://my360lab.com/global/index.php?picture=120&picture=119&picture=113&picture=115[/url] and it needs to send you to [url]http://globalhopemarket.foxycart.com&picture=120&picture=119&picture=113&picture=115[/url]

The purpose of this is to tell the shopping cart what pictures were selected.

I’m sure there is a simple solution but I can’t find it for the life of me (my javascript’s not too hot).

Thanks in advance for your help!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@foxycartJun 09.2009 — Hey jsun1310. You'd probably be better off asking this question in our forum as it is kind of specific to FoxyCart: http://forum.foxycart.com/

If you just add class="foxycart" to your form tag (not the submit tag or input tags), you shouldn't need any JavaScript at all. The cart will load up with the values you specify. You probably also want to have different names for your checkboxes other than "picture". Each input tag should have a different name.

If you'd like to have a single form with multiple products on it, this page may help: http://wiki.foxycart.com/getting_started:adding_links_and_forms#adding_multiple_distinct_products_at_once
×

Success!

Help @jsun1310 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.30,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...