Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > GUI Development
  New Posts New Posts RSS Feed - Validating Last Field on Form
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedValidating Last Field on Form

 Post Reply Post Reply
Author
Message
Deech View Drop Down
Moderator Group
Moderator Group

Moderator -- GUI Development

Joined: December 15 2003
Status: Offline
Points: 177
Post Options Post Options   Thanks (0) Thanks(0)   Quote Deech Quote  Post ReplyReply Direct Link To This Post Topic: Validating Last Field on Form
    Posted: March 28 2004 at 2:25pm
Okay here's a problem I've been having that maybe someone could give me an better answer for:

I have a screen. It has tabs. On the form outside the tab group control I have buttons: Save, Cancel and other command buttons. I have added a field at the end of the screen, inside the tab page, and it has a validate event. If the user enters a value greater than 10 it is supposed to return to the field and let them fix their error. If they hit the TAB button, that's exactly what happens. However, if the user enters an invalid value and then without leaving the field, clicks on the save button or cancel button, despite my use of ATGUIACTIVATE in the validate event, it obediently saves the value and/or closes the form.

So far the only way I have I figured how to stop this is by setting some kind of flag variable in the field's validate event that is checked by the click event of the command buttons. Don't do anything if this flag is set.   This seems like a less that ideal solution.

Anybody have a better idea?

Thanks,
Deech
Accuterm GUI--Changing the Face of MV Development!!
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: April 02 2004 at 5:41am
Hi Deech -

This is the correct solution. This is precisely the reason that one of the event arguments in the Validate event is the ID of the control causing validation. If the Validate event is caused by clicking the Cancel button, you can tell in the Validate event handler that this is the cause and skip data validation, since the Cancel click event will be next. On the other hand, if the Validate event was triggered by clicking the Save button, you can set a flag that the form data is invalid, and check the flag in the Save click event handler to determine whether the update should occur.

Thanks,

Pete
Back to Top
anonymous View Drop Down
Groupie
Groupie


Joined: January 15 2004
Location: United States
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote anonymous Quote  Post ReplyReply Direct Link To This Post Posted: April 05 2004 at 10:55am
I have a questions concerning the AccuTerm GUI Runtime - If I have the VALIDATE event turned on for a control, change that control, then click on the EXIT menu or toolbar, then the EXIT click will be given to the runtime before the VALIDATE. The same thing happens if I click on the SAVE menu or toolbar. Is this correct?
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: April 05 2004 at 10:59am
This is correct - the menu never actually is active - the control is still active which is why the Validate event has not fired. You could be using a menu to do something like Copy or Paste, and you probably do not want the Validate event to fire at that time. So, menu and toolbar Click events do not cause a Validate.

Thanks,

Pete

Back to Top
anonymous View Drop Down
Groupie
Groupie


Joined: January 15 2004
Location: United States
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote anonymous Quote  Post ReplyReply Direct Link To This Post Posted: April 05 2004 at 11:01am
So, if you have a form that has field validation on all of the inputs, and a Toolbar/Menu with the save/exit in it, do you have any recommendations on how to make sure that all of the field validation has been done? As it is, if they change a text entry box and click save, then the field is never validated and, at most, the validate event is passed after the save event.
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: April 05 2004 at 11:03am
You have two choices here. In the click event for Save, either read the data from the GUI form (ATGUIGETUPDATES, ATGUIGETVALUES, ATGUIGETPROP) and re-validate before saving, or check what the active control is, and if its a control that requires validation, explicitly call the validation routine in the Save click event handler. You can get the active control ID by calling ATGUIGETACTIVE.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.