scottk
scottk

Reputation: 57

Passing the value of an HTML form to another form

I have a HTML form which allows a radio button selection of two products. After the product is selected, the user has the option of digital download or delivery of which there is a separate form for each asking different questions.

I need to ensure that the product selection is passed to either of the two form for when the user makes the decision on which delivery option to opt for. Only one of the forms is submitted.

Basically I have:

Form1: Product Selection Radio Button (2 Options)

// Choice of delivery options hidden by a javascript reveal of the relevant form

Form2a: Digital download form fields with actions for validation and submission to Paypal

Form2b: Regualar delivery form fields with actions for validation and submission to Paypal

I look forward to a solution from the excellent minds on this site!

Upvotes: 0

Views: 160

Answers (1)

John Rix
John Rix

Reputation: 6683

Assuming this is all on a single page, it sounds like you don't really need multiple forms. I would suggest just including everything in a single form, wrapping the applicable questions for each selection in separate <div> tags and using some JavaScript to present the applicable <div> when either radio button is selected. When the form is submitted, check the radio button selection on the server side to determine which other form fields to utilise.

Upvotes: 3

Related Questions