Hi all,
I am developing an allegedly simple application for usage in a browser.
I have two buttons on my form to set a status with history. They are written in JavaScript and do not cause a JS error in the browser.
Here is the JS code:
var jetzt = new Date();
var _history = “Active (” + document.forms[0].web_UserName.value + " on " + jetzt.getTime() + “)”;
document.forms[0].docStatusNum.value = 0;
document.forms[0].docStatus.value = “Active”;
document.forms[0].docStatusBy.value = document.forms[0].web_UserName.value;
document.forms[0].docStatusOn.value = jetzt.getTime();
document.forms[0].docStatusHistory.vlaue = _history + “;” + document.forms[0].docStatusHistory.value
alert(“Status set to -active-”);
But when I want to save the form (simple action, FileSave and FileCloseWindow) it comes up with an error page saying “Page cannot be displayed”.
I render all fields for HTML.
How can I debug the error occuring ? Or any idea about the error itself ?
Thank you so much !
/ Alex
Subject: Debugging of Web Error ?
Ok, some news:
I looked into the server log and found out, the date/time causes the prob.
After removing the lines, the doc is saved now without errors.
But now I have two other questions:
First: The button does not work ! No change of status is saved !
Second: How can I get the date/time into the right format ?
Thanx for your help again !
/Alex
Subject: Debugging of Web Error ?
Hi Alex.
Your javascript SHOULD be causing an error, because in your last line, you’ve
misspelt .value (as .vlaue)
Heres another problem I’m seeing - I’m not sure if you realize it, but the Date
object’s .getTime() method returns a number (a long to be specific), not a Time
element of the date.
You need to convert your Date into a String, and unfortunately, the toString
method of Date returns a date in a format that Notes does not interpret (I
don’t blame it, the toString is a bloated string representation).
And, again unfortunately, you do not have access to Java’s java.text.DateFormat
or java.text.SimpleDateFormat classes.
But, here’s a method that will return a STRING for the date- one that Notes WILL interpret.
function getDateString(var dt){
var dt = new Date();
var strDate;
strDate=(dt.getMonth() + 1) + "/"
+ dt.getDate() + "/" + dt.getYear()
+ " " + dt.getHours() + ":"
+ dt.getMinutes() + ":" + dt.getSeconds();
return strDate;
}
I hope that helps.
hcl-bot
January 12, 2007, 10:13am
4
Subject: RE: Debugging of Web Error ?
Hi Steve,
cool, this works ! Thank you !
I think the mispelled value caused the saving-error, cause now everything is saved fine, including the date.
This produced a new question:
After displaying my form processed message I return via a link to a view, including the document just modified. But the view is not refreshed. How could I do this ?
Thanx,
/Alex