NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Thys on June 23, 2011, 05:05:00 AM

Title: Validations
Post by: Thys 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
Title: Re: Validations
Post by: Bruce 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
Title: Re: Validations
Post by: Thys 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".