I’m trying to set up error checking on a text field. It works with regular fields, and checkboxes, but I can’t seem to get it to check an text field.
I have a Verify agent that runs after the form is saved:
'Check theQuestion field...
If Trim( InformationRequest.Question(0)) = "" Then
InformationRequest.Errors = InformationRequest.Question(0) &_
| <B>FIELD:</B>       <A | &_
|ONCLICK=" LinkToTextAreaErrors( 'Question' ); return false"| &_
|HREF="">Question</A> | &_
|must be not be blank.<BR>|
End If
End Sub
In the javascript header I have this, which will allow the user to focus on the text area and start typing when in Edit mode:
ThisDoc = document.forms[0];
function LinkToTextAreaErrors (Name_Of_Field_With_Error)
{
if ( location.href.toUpperCase().indexOf( "EDITDOCUMENT" ) > -1 )
{
ThisDoc .elements[Name_Of_Field_With_Error].focus();
}
else
{
window.alert ("YOU MUST CLICK ON THE 'EDIT' BUTTON TO MAKE CHANGES.");
}
}