Validators and javascript

Hi,

I have a text input control with a regex validator. How can I check, on the client side (javascript), if the input set by the user is valid?

Thanks
Bruno

Your regex validator should run automatically (on the client side) whenever a command control is triggered.

If you want to run the validation manually from a script, you could use the validate method from the CAF model.

See:
http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_sp2/My_webMethods/8-2-SP1_CAF_JavaScript_Reference/CAF.Input.Model.html#validate

For example, something like this in a script block control:

var m = CAF.model('#{caf:cid("input_control_id_here")}');
var msg = m.validate(true);
if (msg == "") {
   //input was valid
} else {
   //input was not valid.  the msg variable contains the reason.
}

Hi,

But how can I show the custom message error under the control ?
exp :
my form contains a text-input, text-area and a dropdown and i wanna check if the 2 first controls are not empty and if the dropdown value respect a format, just with using javascript validation and show the custom msg error under every control?

Thanks and regards

Other than some regex ninjitsu, e.g.

(?!Not Specified).*

is it possible to say NOT EQUALS in validation? This is useful for dropdowns and probably other things (placeholder text in inputs?).