Override Domino Submit

Domino 4.6 introduced the option of using JavaScript when generating a page.
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

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.