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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple buy now buttons on one page

Status
Not open for further replies.

920506

Programmer
Jun 13, 2003
201
US
Hi all,
Before I always had one button on one page, when a use click it, it brings the user to the next page.

Now I have a quote page, it asks a user to enter some data and then give the total price of his choice. But I was asked to display all other three optional choices with its price for each option, whenever user click any one of the button for the final choice. It will go to the next page based on which button he clicked.

I thought I know what to do, but now I am struck.
I want to pass data from page to page through hidden fields, not through query string. And also, what's exact different between submit and input button.
Thank you for any clue.
Betty
 
This is really an HTML question not ASP.
Submit buttons are also input buttons:
<input type="Submit"...
<input type="Button"...

input type of submit causes the page to submit.
input type of button would allow you to call a client-side Javascript or VBScript routine.

In your form tag specify method="post" instead of method="get" so that the data is not posted on the URL.
In your ASP page you read in all the field values like this:
Assume you had fields named CustName, CustID, CustAddr.
You would retrieve those values and store them into hidden fields like this:

CustName = Request.Form("CustName")
CustID = Request.Form("CustID")
CustAddr = Request.Form("CustAddr")

To store them you would have the hidden form fields on the page and insert the values like this:
<input type="hidden" name="CustName" value="<%=CustName%>">
<input type="hidden" name="CustID" value="<%=CustID%>">
<input type="hidden" name="CustAddr" value="<%=CustAddr%>">


It's hard to think outside the box when I'm trapped in a cubicle.
 
If you put each choice inside its own form, you can use a separate submit button for each form, and each one will have its own action and pass only the form element values inside that form. You'll have to replicate all the common data in hidden inputs inside each form, though, so it's passed to the processing page.

Lee
 
Hi Lee and theniteowl,
Thanks for your suggestions. I figured out yesterday.

One form can have four submit button, user can trig only the button they click.
So on each submit button, I have a javascript call when onClick event is trigged before the form submit to the server. With that javascript call, I pass specific parameters to the function call and in that javascript function, I reset the form hidden fields, that way, the new
values will be available when the next page is presented.

Betty
 
Hi Sheco,
Do you mean if javascript is not enabled on their web browser, my program is going to failed, right?
What should I do then? I assume everyone has enabled their javascript in browser.

Thank you.

Betty
 
Hi all,
One way I can think of is to access button name they clicked on the next page.
I only know how to access field value, not field name since I have all same values "buy now".
By identify the button name they clicked, I can handle it easily in the program.

see bellow:
<tr>
<td class="alternate">&nbsp;</td>
<td class="quote"> <input type="submit" name="CFARPlus" value="Buy Now" > </td>
<td class="options"> <input type="submit" name="CFAR" value="Buy Now" ></td>
<td class="options"> <input type="submit" name="NOCFARPlus" value="Buy Now" ></td>
<td class="options"> <input type="submit" name="NOCFAR" value="Buy Now" ></td>
</tr>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top