NetTalk Central

Author Topic: Form Entry Field Validation  (Read 1771 times)

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Form Entry Field Validation
« 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Form Entry Field Validation
« Reply #1 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

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Form Entry Field Validation
« Reply #2 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'
.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Form Entry Field Validation
« Reply #3 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