These pages have links that execute a _doClick() function, which submits the
form to the Domino server along with an action for the Domino server to carry
out. You can override the _doClick() function generated by Domino and insert
custom processing, such as field validation without a server round trip, with
the following code.
Notes:
1. The form's HTML attributes should be set to
"onLoad=\"RedirectDominoSubmit()\"" .
2. The function b_Override is included as a simple validation example. If the
function returns false, the usual Domino action is aborted.
3. This solution is a simplified version of the SubmitOverride object available
from Process Stream Technologies, and may be freely distributed. The actual
object uses a similar technique to provide override behavior that depends on
which button or link was clicked.
<SCRIPT LANGUAGE="JavaScript1.1"><!--
function RedirectDominoSubmit()
{
if( typeof _doClick == "function" )
{
DominoSubmit = _doClick;
_doClick = PreSubmit;
}
}
function PreSubmit( v )
{
if( b_Override() )
DominoSubmit( v );
}
function b_Override()
{
// Custom processing, such as field validation goes here
var hInput = document.forms[0].t_Text;
if( hInput.value == "" )
{
alert( "Please enter a value!" );
hInput.focus();
return false; // don't do the standard Domino action
}
else
return true; // do the standard Domino action
}
//-->
</SCRIPT>
This was first published in November 2000