indypung
asked on
url parameter question
i think this is pretty simple, but i've been struggling with it for awhile so i figured i'd ask for some help. my problem is this. i have a coldfusion page, page1.cfm, that passes a url parameter to a second coldfusion page, page2.cfm. i'm getting the value passed over fine. my problem is that page2.cfm submits to itself. when it submits to itself, i get an error that url.incidentnumber is not defined. how can i store the value of url.incidentnumber when page1.cfm sends it to page2.cfm, but not attempt to read it when page2.cfm submits to itself? thanks.
page1.cfm
<a href="Edit.cfm?IncidentNum ber=#GetSi ngleIncide nt.INCIDEN T_NUMBER#" >EDIT</a>
page2.cfm
<cfparam name="URL.IncidentNumber" type="string">
...
<input type="button" name="SubmitForm" value="Find" onClick="this.form.submit( )">
page1.cfm
<a href="Edit.cfm?IncidentNum
page2.cfm
<cfparam name="URL.IncidentNumber" type="string">
...
<input type="button" name="SubmitForm" value="Find" onClick="this.form.submit(
you could do something like this
<cfparam name="URL.IncidentNumber" type="string" default=''>
<cfif isdefined('form.IncidentNu mber')>
<cfset URL.IncidentNumber=form.In cidentNumb er>
</cfif>
<cfparam name="URL.IncidentNumber" type="string" default=''>
<cfif isdefined('form.IncidentNu
<cfset URL.IncidentNumber=form.In
</cfif>
The problem is the value on your second page isn't defined, there's a few ways to solve your issue, rob_lorentz, CFDevHead, already provided something that would work, but I thought I'd throw my 2cents in.
Another way i... add a hidden field..
<cfinput type="hidden" name="IncidentNumber" value="#form.IncidentNumbe r#">
this will then define and retain that value...
~trail
Another way i... add a hidden field..
<cfinput type="hidden" name="IncidentNumber" value="#form.IncidentNumbe
this will then define and retain that value...
~trail
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
all good answers. i awarded points to the one i chose to use. thanks for all for your help.
bp
bp
Np, if you have any more questions or if something isn't working, just post below and I will continue answering them.
-Matt
-Matt
cgi.query_string contains all the url parameters passing into a page. in page1.cfm add them to the form that posts to page2
<cfoutput>
<form action="page2.cfm?#cgi.QUE
</cfoutput>