NetTalk Central

Author Topic: Detecting cancel button press and Invalid fields berfore exiting a NetWebForm  (Read 3759 times)

mtabakin

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Email
I have a NetWebForm and when the user clicks SAVE I want to do some "Post Processing" of the data on the form and put some of the manipulated data into another table. I added this post processing code into the CompleteForm routine and it seems to work EXCEPT I need to know the following:

1. Did the user press the Cancel button and not the save button so I don't post process
2. I have some fields that are Required Fields and it seems that the CompleteForm routine is called before any of the ValidateField routines so I can not check loc:alert or loc:Invalid to not post process if there are required fields that still need data.

I added debug code to CancelForm but it was never called even when I pressed the cancel button.

Where do I embed or what can I check to accomplish #1 and #2 above or is there another way to go about this completely?

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
I would try,...

I have a NetWebForm and when the user clicks SAVE I want to do some "Post Processing" of the data on the form and put some of the manipulated data into another table. I added this post processing code into the CompleteForm routine and it seems to work EXCEPT I need to know the following:

> moving this to postupdate and postinsert and maybe postdelete depending on what you are doing


1. Did the user press the Cancel button and not the save button so I don't post process

> I don't think the above will be called if cancel pressed

2. I have some fields that are Required Fields and it seems that the CompleteForm routine is called before any of the ValidateField routines so I can not check loc:alert or loc:Invalid to not post process if there are required fields that still need data.

> using the above should fix this prob as well

I added debug code to CancelForm but it was never called even when I pressed the cancel button.
> the cancel form is probably called so server side code not run

Where do I embed or what can I check to accomplish #1 and #2 above or is there another way to go about this completely?
> let me know if the above does not work. I've done something similar and would need to check what I did in more detail.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
CompleteForm happens during the ValidateRecord, so it's pre-save, not post save.
Thus it's not suitable for "post processing".

I would do what Kevin suggested;

> moving this to postupdate and postinsert and maybe postdelete depending on what you are doing

Bruce

mtabakin

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Email
Kevin/Bruce,

Thanks! That's just the embed point I needed - if the user clicks cancel nothing happens in my post processing and if a field is invalid, nothing happens until they enter valid data into the field.