OnQueryClose in Page

armela20armela20 Member Posts: 71
edited 2010-12-10 in NAV Three Tier
Hi there.
I have added some code to not leave the Customer page when the Address field is not filled in.
This works great when u are in a edit mode or Create new mode. If I click ok or the X button on the page my page will not close and my users are forced to fill in the info.
Now here is the challenge.
When I delete a customer record, it thinks that my address field is still not filled it. I added code to say if "No." <>'' then run the code but that does not work, as at that point the "No." field still holds the value.
I added some messages and it seems like the OnQueryclose is run before the delete trigger on the page.
Has anyone done smth like this before ??
Any suggestion as to where should I add my code so that this works. It really works great on existing on new customers, but when user deletes a customer they can not leave the page and that is truly a show stopper as they are stuck on that page now.

Any help is much appreciated.

Comments

  • SavatageSavatage Member Posts: 7,142
    why delete the customer instead of just blocking it?

    if you search the forum for "mandatory fields" you'll see other options on how to avoid blank fields.

    the one i like is defaulting any new customer to blocked. Then use testfield function to test for values in the mandatory fields when someone tries to unblock it and make it active. This forces them to fill in all desired fields before unblock is allowed. You also then add property notblank to those fields so nobody can clear them afterwards.

    done 8)
  • BeliasBelias Member Posts: 2,998
    Savatage wrote:
    why delete the customer instead of just blocking it?

    if you search the forum for "mandatory fields" you'll see other options on how to avoid blank fields.

    the one i like is defaulting any new customer to blocked. Then use testfield function to test for values in the mandatory fields when someone tries to unblock it and make it active. This forces them to fill in all desired fields before unblock is allowed. You also then add property notblank to those fields so nobody can clear them afterwards.

    done 8)
    Very smart!it is definitely to add to my "best practices" list!thank you :thumbsup:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.