CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 onclick event of button to put value in date field

Print topic Send  topic

Author Message
kevind

Posts: 251
Posted: 11/03/2004, 8:56 AM

I have a date/time field in a time billing app. I have placed a button beside it labelled NOW that I want to be able to click and have it stuff the current time into the time field END1.

I have created a client side event to do this through CCS interface with a line of code:

document.timesheet1.end1.value=now

When clicked the field does not get filled in. I have tried DATE and NOW() with brackets but, it still won't put the current time or date into this date time field.

If I put a static value in quotes then the onclick event works - how do i get the time to convert to a string ?

thanks
Kevin
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
peterr


Posts: 5971
Posted: 11/03/2004, 9:06 AM

Not sure if "now" is a valid JavaScript function, couldn't find it here: http://www.google.com/search?hl=en&q=javascript+function+reference+now
Here are some JS functions for obtaining current time: http://www.google.com/search?hl=en&q=javascript+current+time
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
kevind

Posts: 251
Posted: 11/03/2004, 9:20 AM

Seems a long bit of code for a simple task. Is there VBScript I can use instead and some way of marking the event as VBScript language ?

thanks
Kevin
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
peterr


Posts: 5971
Posted: 11/03/2004, 9:29 AM

Good question. A direct answer would be that if you use client events then by default the JavaScript is used, and I wouldn't recommend changing it.
However, I always use events for server-side code but rarely for client-side because any standard JavaScript/VBScript code can be placed in HTML and events are not needed here (they may be helpful from IDE point of view but for me it's an overkill). Thus in your case I wouldn't even use an event, I would just find some JavaScript (or VBScript if you like) and put it directly in HTML.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
kevind

Posts: 251
Posted: 11/03/2004, 10:02 AM

OK, thanks. I'll try VBScript in HTML and nix the events.
_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
View profile  Send private message
kevind

Posts: 251
Posted: 11/11/2004, 2:16 PM

Found a better solution which only requires 1 line of code.

I'm updating a record in a form so, it is loaded when I click on the link in the grid and I do this:

1) create a hidden field with a before show event of retrieving the current time(). Field is Data Type DATE and format of time.

2) create the button and make a client side event for on-click of custom code:

document.form.TargetField.value=document.form.HiddenField.value ;

Don't forget the semi-colon or it won't work.


Kevin

_________________
thanks
Kevin

======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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