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

Passing a date variable

Status
Not open for further replies.

programmher

Programmer
May 25, 2000
235
US
I have a date variable on one form. Below is the code:

<TD> <INPUT type=&quot;text&quot; name=&quot;location_to&quot; maxLength=&quot;15&quot; value=&quot;<cfoutput>#DateFormat(DateRequested, &quot;mm/dd/yyyy&quot;)#</cfoutput>&quot;>

This field is automatically updated when the user selects a date from the calendar on the page.

My problem occurs when I attempt to pass the value of the DATEREQUESTED field to the appropriate field.

Here is how I am passing the variable. The dates correctly appears in my URL:

<cfform action=&quot;Cal2.cfm?daterequest=#DatePart('m', DateRequested)#/#DatePart('d', DateRequested)#/#DatePart('yyyy', DateRequested)#&quot; method=&quot;POST&quot; enablecab=&quot;Yes&quot;>

This is the code on my receiving page:

<TD valign=&quot;top&quot;> <b>LOCATION TO:</b> </TD>


<TD> <input type=&quot;text&quot; name=&quot;location_to&quot; value= </TD>

No matter what I put in the value field, I can not get my date to correctly appear! Can any lend assistance?!? I am at my wit's end!

 
On the receiving page, you don't list any code that references the variable. To pull it out of the url, you'll need to reference it as #url.daterequest# or just #daterequest# if there are no name conflicts.

If it's supposed to show up as the value in this line:

<TD> <input type=&quot;text&quot; name=&quot;location_to&quot; value= </TD>

you will need to change it to this:

<cfoutput>
<TD> <input type=&quot;text&quot; name=&quot;location_to&quot; value=&quot;#url.daterequest#&quot;></TD>
</cfoutput>

Hope this helps,
GJ
 
GJ,

When I place <cfoutput>s around my code, I get a
&quot;contact site administrator&quot; error message.

I attempt to pass my date variable to my receiving page with this:

<cfform action=&quot;Cal2.cfm?#DateFormat(DateRequested, &quot;mm/dd/yyyy&quot;)#&quot; method=&quot;POST&quot; enablecab=&quot;Yes&quot;>

My receiving page looks like this to receive the variable:

<TD> <input type=&quot;text&quot; name=&quot;location_to&quot; value=&quot;#daterequest#&quot;></TD>

I tried referencing the date as #url.daterequest#; but my text box just reflects #url.daterequest#.

I feel that I'm missing something obvious. Is there any more light you can shed?
 
I think I see my confusion. In your first post, I thought the input box named &quot;location_to&quot; was being used to send the date to the receiving script. If that input is only on the receiving script and you are passing a variable just with the url variable, this should be what you need.

<cfoutput>
<cfform action=&quot;Cal2.cfm?daterequest=#urlencodedformat(&quot;#DatePart('m',
DateRequested)#/#DatePart('d', DateRequested)#/#DatePart('yyyy',
DateRequested)#&quot;)#&quot; method=&quot;POST&quot; enablecab=&quot;Yes&quot;>
</cfoutput>

In the receiving script,
<cfoutput>
<TD> <input type=&quot;text&quot; name=&quot;location_to&quot;
value=&quot;#url.daterequest#&quot;></TD>
</cfoutput>

Let me know if you still get an error and if so, what the message is.
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top