Using this javascript in one of my forms to timestamp it, (just a simple protected text field.)
form1.MainPage.DateTimeStamp::docReady - (JavaScript, client)
if (form1.MainPage.DateTimeStamp.rawValue == null) {
var now = new Date();
form1.MainPage.DateTimeStamp.rawValue = nowtoDateString() + now.toTimeString();
}
This timestamps the form as it should. The problem is on another form I'm building I'm using the identical script, (with different absolute paths of course,) and I keep getting a javascript error about date not being a constructor. I've type the script in ten bajillion times and I'm at a loss for what is causing this.
All I want is a simpel javascrip where I can display the time/date from the users system in a text field.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Is there maybe something else in this form called Date ... a subform, field, script object or something that JavaScript would pick up first before the inbuild Date object?
Views
Replies
Total Likes
Hi,
You are missing a . inbetween "now" and "toDateString()"
Also you can simplify the script as it is in the docReady of the textfield:
if (this.rawValue == null)
{
var now = new Date();
this.rawValue = now.toDateString() + " " + now.toTimeString();
}
Hope tht helps,
Niall
Views
Replies
Total Likes
As you instructed:
form1.MainPage.DateTimeStamp::ready:form - (JavaScript, client)
if (this.rawValue==null)
{
var now=new Date();
this.rawValue=now.toDateString()+""+now.toTimeString();
}
give me this still...
Views
Replies
Total Likes
Hi,
If the textfield object is on the Master Page, can I suggest moving the script to the docReady event?
Hope that helps,
Niall
Views
Replies
Total Likes
still didn't work.
I've used this script in other forms without a problem. Exact same script in this form...not working.. I'm totally stumped.
Views
Replies
Total Likes
Can you share the form?
If so, you could upload it to a file sharing site like Acrobat.com and then post the published URL here.
Niall
Views
Replies
Total Likes
Hi,
Is there maybe something else in this form called Date ... a subform, field, script object or something that JavaScript would pick up first before the inbuild Date object?
Views
Replies
Total Likes
BROO1 nailed it. I had a field named "Date". Changing this to UsageDate fixed the issue and the script time stamped the form just fine. Thank you very much!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies