Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form to form value exchange

Status
Not open for further replies.

andrewgrain

Programmer
Sep 18, 2001
3
GB

I have a personalised gift product shop. I am using PayPal add to cart button code, but want to add text fields in a seperate form to any product selected as the options eg

1. User fills in options in form1 eg To: Baby James, From : Mum & Dad, Dedication: Lots of love etc

2. User clicks add to basket for a chosen product eg a card, mug, pen etc

3. values of form1 to be concatinated and assigned to the hidden option value fields, os0 or os1 of the selected product

4. Add the product to the cart with options.

How can I do this
Many thanks.
 
Instead of concatenating them, wouldn't it be easier to have different hidden fields for each of the form items? (I'm assuming here that there's a reason for the hidden fields, as opposed to just relying on the ACTUAL fields in the form).

Code:
<input type='hidden' name='hiddenTO' />
<input type='hidden' name='hiddenFROM' />
<input type='hidden name='hiddenDEDICATION' />

Then, in your javascript:

Code:
formName.hiddenTO.value = formName.userToField.value;
formName.hiddenFROM.value = formName.userFromField.value;
...

If you absolutely MUST concatenate:

Code:
<input type='hidden' name='concatenatedFields' />

Then, in your javascript:

Code:
formName.concatenatedFields.value = formName.userToField.value + "*" + formName.userFromField.value + "*" + formName.userDedicationField.value;

Is this the kind of thing you're talking about needing?

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top