CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ColdFusion

 CF Hidden Field to insert Date & Time into MS QSL db

Print topic Send  topic

Author Message
Matt
Posted: 09/08/2005, 12:05 PM

I have created a ColdFusion web survey. I have been searching & can't find the code to use to insert the current date & time into my MS SQL db when a survey is submitted.

I am sure that this is real easy & my last 3 hours of searching were wasted but I would apprecaite any and all ideas from you all.

Thank you,

Matt
Graham Pearson
Posted: 09/08/2005, 3:14 PM

Here is how I do this. I create a Hidden Form Object within the form and
name it SubmitDate. I also add the Field From the database as the
Control Name then while that object is selected I do a Before Show Event
to add the code <cfset fldSubmitDate = #Now()#>

This will get you in the right direction but if you need assistance just
let me know, I will boot up the VMWare Session which has CCS installed
on it to give you a Step by Step procedure to complete this task.



Matt wrote:
> I have created a ColdFusion web survey. I have been searching & can't find the
> code to use to insert the current date & time into my MS SQL db when a survey
> is submitted.
>
> I am sure that this is real easy & my last 3 hours of searching were wasted but
> I would apprecaite any and all ideas from you all.
>
> Thank you,
>
> Matt
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
Matt
Posted: 09/09/2005, 6:50 AM

Thanx Graham! I appreciate your help. I got it to work with your help & a little more searching.
I was able to return the date & time using the following string:

<input name="SubmitDate" type="hidden" id="SubmitDate" value="<cfoutput>>#DateFormat(Now())# #TimeFormat(Now())#</cfoutput>">

Thank you very much for your help! I'll be sure to come back here for my upcoming questions that I know I will have as I work to learn CF & SQL.

Matt
Graham Pearson
Posted: 09/09/2005, 8:36 AM

Do not hesitate to ask your questions. I have been using CF for 6 Years
and CCS for 2. I have done all kinds of applications within CCS+CFML and
my list is growing every week.


Matt wrote:
> Thanx Graham! I appreciate your help. I got it to work with your help & a
> little more searching.
> I was able to return the date & time using the following string:
>
> <input name="SubmitDate" type="hidden" id="SubmitDate"
> value="<cfoutput>>#DateFormat(Now())# #TimeFormat(Now())#</cfoutput>">
>
> Thank you very much for your help! I'll be sure to come back here for my
> upcoming questions that I know I will have as I work to learn CF & SQL.
>
> Matt
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
Martin
Posted: 09/12/2005, 6:26 AM

I also use a Hidden Form Object within the form for tracking the date and time off the user entry like Graham.
But I place a custom code in the BeforeInsert (or BeforeUpdate) Event to set the hidden field to the actual time.
Then I have the date and time the user is posting the entry.

Martin
kpa

Posts: 27
Posted: 11/02/2005, 6:41 PM

I was always taught that where possible get the database to do the work - I set date time stamps for all rows added to a table whether I think they are needed for the app or not. In the case of SQL Server I give the field a default value of getDate() so that whenever a row is added the database gives that field a value at the time of insert, no coding required..
_________________
++++++
kpa
++++++
View profile  Send private message
Martin
Posted: 11/30/2005, 9:48 AM

Hi kpa,

your right with record inserts, but what is with
tracking record updates?

Martin
steve
Posted: 12/01/2005, 4:06 PM

:-)<input name="SubmitDate" type="hidden" id="SubmitDate" value="<cfoutput>>#DateFormat(Now())# #TimeFormat(Now())#</cfoutput>">

da kine brah!

thanks
Andreas
Posted: 04/06/2006, 9:37 AM

Arn't there browser incopatible with hidden entities? Like FF.
MaFi

Posts: 45
Posted: 04/10/2006, 7:14 AM

Quote Andreas:
Arn't there browser incopatible with hidden entities? Like FF.

As fare that I know, there are no. There might be if you use
CF Tags like CFINPUT, due to Java Applets.

Regards

Martin
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.