Hi S.Y.M. Wong-A-Ton, I could follow your instrauctions to step 11 ok. I was
not confident adding the extra line of code but did what you said. my code
for start and end time now looks like:
/*
* This file contains functions for data validation and form-level events.
* Because the functions are referenced in the form definition (.xsf) file,
* it is recommended that you do not modify the name of the function,
* or the name and number of arguments.
*
*/
// The following line is created by Microsoft Office InfoPath to define the
prefixes
// for all the known namespaces in the main XML data file.
// Any modification to the form files made outside of InfoPath
// will not be automatically updated.
//<namespacesDefinition>
XDocument.DOM.setProperty("SelectionNamespaces",
'xmlns:my="
http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-01-24T23:21:32"');
//</namespacesDefinition>
//=======
// The following function handler is created by Microsoft Office InfoPath.
// Do not modify the name of the function, or the name and number of
arguments.
// This function is associated with the following field or group (XPath):
/my:myFields/my:timeEntries/my:timeEntry/my:startTime
// Note: Information in this comment is not updated after the function
handler is created.
//=======
function msoxd_my_startTime::OnAfterChange(eventObj)
{
// Write code here to restore the global state.
if (eventObj.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
updateFields(eventObj.Source);
}
// A field change has occurred and the DOM is writable. Write code here to
respond to the changes.
}
//=======
// The following function handler is created by Microsoft Office InfoPath.
// Do not modify the name of the function, or the name and number of
arguments.
// This function is associated with the following field or group (XPath):
/my:myFields/my:timeEntries/my:timeEntry/my:endTime
// Note: Information in this comment is not updated after the function
handler is created.
//=======
function msoxd_my_endTime::OnAfterChange(eventObj)
{
// Write code here to restore the global state.
if (eventObj.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
updateFields(eventObj.Source);
}
// A field change has occurred and the DOM is writable. Write code here to
respond to the changes.
}
If I try to Preview the Form at this stage I get the following error message:
nfoPath cannot open the selected form because of an error in the form's code.
The following error occurred:
Syntax error
File:script.js
Line:37
At step 16 I am also confused. I could not down load the JScript File. It
would not open. Do I just copy the code you wrote in step 16. If so then
where do I copy it to? Does it go into totalHours? Sorry to keep hounding you
but I am out of my league when we get into code. Thanks Geoff