Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2003, 02:42 PM
Authorized User
 
Join Date: Jun 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default General Form data submission questions

Hi:

I think I know the answer to these questions, but I'd like to verify them if I may:

1) Is there any way to submit data to the 'Forms' collection without clicking on a button? For an email piece, I'd like to stuff information into hidden text fields and submit them as part of the 'Forms' collection when the recipient clicks on a link, rather than build up a link with the values.

I don't think that there is a way to do this aside from possibly writing some Java and using some sort of event mechanism to simulate pressing the button when the link is clicked.

2) Is there a mechanism where data is transmitted BOTH in the 'Forms' collection AND in the 'Querystring' collection for access through the REQUEST object?

I don't believe there is, that data is sent in only one of the two collections, depending on the Method selected.

The goal here is to keep certain information as hidden as possible. I know 'Hidden' fields are not secure, but they are not obvious as data in the URL is. 'Not obvious' is probably good enough

Thanks for for your time.

JK
 
Old November 10th, 2003, 03:01 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

1) What you'd need to do is have your links make javascript calls instead of URLs in the href attribute. You'll most likely have to come up with some method to define what link you clicked on so that the processor of the form can pass you on to the right place referrenced by the link.

<a href="doSubmit('myAccount');">Go To My Account</a>
<input type="hidden" name="hidOperation" value="" />

<javascript>
function doSubmit(sDestination){
    //set some hidden form field to sDestination value
    document.myForm.hidOperation.value = sDestination;
    document.myForm.submit();
}
</javascript>

<processing ASP>
'Do everything you need with the submitted form
Select Case Request("hidOperation")
    Case "myAccount": Response.Redirect("myaccount.asp")
    Case ...
End Select
</processing ASP>


2) Actually, both methods work all the time. When you specify what method to use in the form, all you are doing is telling the browser where to put the form data: either on the query string or in the POST data section of the HTTP request.

If you set your action value of the form to "myPage.asp?something=10" and you submit that page, you'll see that the querystring is retained on the destination page. You could easily modify the action value itself in JavaScript if you wanted to tack on additional query string values before you posted the form. Both collections are there and accessible all of the time.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old November 10th, 2003, 05:01 PM
Authorized User
 
Join Date: Jun 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Peter:

I understand. I have no experience with Javascript nor the document object model but I definitely need to move in that direction.

As for having both the forms and querystring collections populated, that makes perfect sense. I thought they could co-exist, but I couldn't make it happen in any tests I came up with. It never occurred to me that the 'Action' could include a set of key/value pairs that could be used in conjunction with the values submitted via a form.

Thanks, that's a help.

JK





Similar Threads
Thread Thread Starter Forum Replies Last Post
form submission...help!? mdbrueckner ASP.NET 2.0 Basics 1 September 19th, 2007 06:16 PM
General Application Questions. RPG SEARCH ASP.NET 1.x and 2.0 Application Design 2 March 2nd, 2005 12:38 PM
Simple Form Submission Maxood Beginning PHP 3 July 17th, 2004 06:03 AM
conditional form submission moushumi Classic ASP Basics 1 March 30th, 2004 08:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.