NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: ianburgess on June 13, 2012, 07:41:01 AM

Title: Form Entry Field Validation
Post by: ianburgess on June 13, 2012, 07:41:01 AM
I have a password entry field (USE:Password) on a form and need to enforce that it is a minimum of 6 characters long and with at least 1 number and one letter. Can anyone suggest what code and where to embed in order to enforce and pop up a message and not allow saving if criteria not met?

Thanks

Ian
Title: Re: Form Entry Field Validation
Post by: Bruce on June 14, 2012, 01:20:06 AM
Hi Ian,

the code itself should be simple enough.

as to embed point, put it in the
validateValue::fieldname routine
have a look at the generated code as to what to do if the validation fails.
(setting the field to say "required" will generate some sample validation code for you.)

cheers
Bruce
Title: Re: Form Entry Field Validation
Post by: ianburgess on June 14, 2012, 02:36:09 AM
Ok thanks for that - I can now see what the "Required" code is doing and can create my own code embedded after that to do my own validation:

e.g.
IF LEN(CLIP(USE:Password)) <6
  loc:Invalid = 'USE:Password'
  USE:Password:IsInvalid = true
  loc:alert = 'Password must be at least 6 characters long'
.
Title: Re: Form Entry Field Validation
Post by: Bruce on June 14, 2012, 06:10:20 AM
exactly.

(Incidentally it's considered "better" to write "end" rather than "." at the end of a loop.
The . syntax is soooo 20th century.

Cheers
Bruce