NetTalk Central

Author Topic: Validations  (Read 1868 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Validations
« on: June 23, 2011, 05:05:00 AM »
On a web form I have the following quesitons:

1. The value in loc:invalid should indicate to which field the focus must return, but it does not. Should it?
2. Now because focus is not set to the error field, I have to repeat the validation on the save button. Is that correct?

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Validations
« Reply #1 on: June 23, 2011, 05:17:12 AM »
>> 1. The value in loc:invalid should indicate to which field the focus must return, but it does not. Should it?

Validation is done in the ValidateValue::FieldName routine.
If validation fails, you should set
    loc:Invalid = 'Fieldname'
    FieldName:IsInvalid = true
    loc:alert = 'some message'

This routine is called when the field completes (if auto-validation for the field is on) and when the user clicks on Save.

>> 2. Now because focus is not set to the error field, I have to repeat the validation on the save button.

Validation is always repeated when the Save button is pressed. The data from the browser is untrustworthy. When the Save button is pressed a disk-write is about to be made, so the same ValidateValue routine is called.

cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Validations
« Reply #2 on: June 23, 2011, 05:58:48 AM »
Thanks Bruce, then you would need to correct web53.app to add the line with ":IsInvalid=true".