NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Matthew on June 28, 2012, 01:55:52 AM

Title: Validate Update while Save Form - question
Post by: Matthew on June 28, 2012, 01:55:52 AM
Hello

I have some question about validate update routine and save form.

I have memory form with save button and in "Validate Update" routine I put some additional validation. For example:
IF p_web.GSV('Name') = ''
  loc:invalid = 'Name'
  loc:alert = 'Blank name'
END

At the and of this routine I write log in my LogTable, to know if form was save without or with errors.
For example:
SaveLog(loc:alert) ! Save description of error to LogTable

My question is:
Why "Validate Update" routine is call twice when loc:invalid <> ''? In other words, when validation was incorrect. This is a bug or a normal situation?

Each time if validation was incorrect my procedure SaveLog(...) is call twice and write two exactly same records in LogTable.

Can I do something to call "Validate Update" routine once after wrong validation?

Regards,
Matthew
Title: Re: Validate Update while Save Form - question
Post by: Rob de Jager on June 28, 2012, 05:42:06 PM
Hi Matthew, I might be missing something, but try setting the field as a required field. It removes the requirement for your code. Then look for a suitable embed point around the alert routine to do our logging.

Cheers

Rob
Title: Re: Validate Update while Save Form - question
Post by: Matthew on June 28, 2012, 11:00:23 PM
Thank You Rob for Your suggestion.

Setting the field as a required field is not enough. Because I have to put some additional validation and according to NetTalk examples that validation should be put in Validate Update routine.

I remember that in some previous version of NetTalk 6 when I save form and there was validation error, "Validate Update" routine was call once. Maybe something was change in  the mechanism of validation.

Regards,
Matthew
Title: Re: Validate Update while Save Form - question
Post by: Bruce on July 01, 2012, 10:59:03 PM
Validation for a field is usually called when the field completes, and when the form completes.

cheers
Bruce