Expand my Community achievements bar.

set focus when date validation fails

Avatar

Level 1

I want to set the focus of the cursor back to the date field when the validation fails... so far ive tried this and it does not work. 

joBeth

topmostSubform.Page2.DatOfAp::validate - (JavaScript, client)

DatOfApformat = /^\d{2}\/\d{2}\/\d{4,2}$/

if(! DatOfAp.rawValue.match( DatOfApformat ) ) {

xfa.host.messageBox( "Please enter a date (for example 04/14/1978)." );

this.rawValue = null;

xfa.host.setFocus("DatOfAp");

}

1 Reply

Avatar

Level 10

Hi,

The set focus takes a somExpression, try;

xfa.host.setFocus(DatOfAp.somExpression);

Regards

Bruce