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!

Automaticly Passing Form Fields

Status
Not open for further replies.

ibwebn65

Programmer
Sep 4, 2002
22
US
I want to send simple data variables to a template. The template will do some processing. When the template is done processing, it needs to be able to automatically (without user intervention) send the data to another template as form variables along with the user. So, basically, the user will never see the intermediate processing page, only the final destination page. The final destination page only allows form variables. I cannot edit the final destination page. Is there a way to do this with ColdFusion?
 
Although I don't know if this is the best way to do it I would , from the first template:

Code:
<CFLOCATION url="telplate2.cfm?var1=something&var2=somethingelse&var3=evenmoredata">
<CFABORT>

-Al
 
Opps sorry, I missed the form variable part.

Instead of

Code:
var1=something

in my example above... I would do

Code:
var1=<cfoutput>#FORM.something#</CFOUTPUT>

-Al
 
those will give you url variables not form variables.

the form variables only exist on the processing page. if you need them to go a page further you'll have to create a form with all hidden form fields and submit the page automatically with javascript to make the form variables again.

... but then again... I wonder if you could use cfheader to do it... hmmm...

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
looks like you'd have better luck with cfhttp.


If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Why can't you just convert the FORM variables from the first template to URL variables on the second template? Since neither needs to have the FORM. or URL. you'd just use the varaible name in the second template.

I.E. instead of using

<CFIF isdefined("FORM.var1")>

you'd do

<CFIF isdefined("var1")>

Now it doesn't matter if the template gets a FORM or URL variable, it will work with both.

-Al
 
because he said
The final destination page only allows form variables. I cannot edit the final destination page

if the page was written poorly and doesn't specify the form scope that may work.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Albion - The final page can only receive form variables. Even with the updated code you presented, it still would be sending URL variables to a template that only receives form variables.

Your code:
var1=<cfoutput>#FORM.something#</CFOUTPUT>

Concerning you second response about removing the form scope in the variable. It would be great if I could do that on the final page, but I can not edit the final page. Which limits me to only sending it form variables. Plus there is information that would be in the variable being sent that I would not want to display in a URL variable.

==========================================
bombboy - Your kind of in the right area. The processing page would need to send form fields, most likely hidden form fields, to the final page. If possible, I would like to avoid JavaScript to execute the Submit. It could be a problem if JavaScript was disabled.

CFHEADER would not do the job. It only deals with pre-defined header variables.

CFHTTP also would not do the job. While it would send the data to another page, it would not send the user to the same page at the same time. You could use a cflocation after the CFHTTP to send the user and the data to the same page, but that would send the user and the data to the same page at two different times.
 
i'm out of ideas. sorry.

if you have a middle page between the form and the end processing page the middle page is effectivly acting as a barrier. The form will have to be resubmitted somehow, with a new action being the final page.

what kind of processing are you doing before the final page?

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
would something like this work.

Maybe send the user to the page or use the cfhttp to run the page.
Code:
<body onLoad="document.myForm.submit();">
<FORM NAME="myForm" method="POST" action="somepage.cfm">
<input type="hidden" name="something" value="somevalue">
</FORM>
</body>


Kris Brixon

If you're not failing every now and again, it's a sign you're not doing anything very innovative.
- W. Allen
 
that would work but as he said he wants to avoid javascript to do the submit.

onLoad="document.myForm.submit();"

is javascript

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top