![]() |
| The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum. |
|
Post Reply
|
| Author | |
Deech
Moderator Group
Moderator -- GUI Development Joined: December 15 2003 Status: Offline Points: 177 |
Post Options
Thanks(0)
Quote Reply
Topic: Validating Last Field on FormPosted: 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!!
|
|
![]() |
|
PSchellenbach
Admin Group
Moderator Joined: December 15 2003 Location: United States Status: Offline Points: 2150 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
anonymous
Groupie
Joined: January 15 2004 Location: United States Status: Offline Points: 46 |
Post Options
Thanks(0)
Quote Reply
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?
|
|
![]() |
|
PSchellenbach
Admin Group
Moderator Joined: December 15 2003 Location: United States Status: Offline Points: 2150 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
anonymous
Groupie
Joined: January 15 2004 Location: United States Status: Offline Points: 46 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
PSchellenbach
Admin Group
Moderator Joined: December 15 2003 Location: United States Status: Offline Points: 2150 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |