Home » Developer & Programmer » Forms » Track back triggering button in when-validate-(record/item) (Forms6i)
Track back triggering button in when-validate-(record/item) [message #392796] Thu, 19 March 2009 05:26 Go to next message
didiera
Messages: 134
Registered: August 2007
Location: Mauritius
Senior Member
Hello again everyone,

I was trying to implement something here but I might not be right in my assumption. I am trying, from within an when-validate-item or when-validate-record to know (form runtime system variables :system) which object fired the latter trigger in order to either go along with validation or short-circuit this process. In clear I just want that when I press 'Cancel' or 'Delete', I don't get any 'This field requires a valid amount' kind of behaviour. When setting the buttons 'Keyboard' and 'Mouse Navigable' properties to 'No', I get to implement my cancel logic but still with the stupid message and I was just thinking if something of the kind I introduced above couldn't be achieved with a reasonable amount of additional code, preferrably, from within the when-validate-thing trigger itself.

regards,
Didier
Re: Track back triggering button in when-validate-(record/item) [message #392851 is a reply to message #392796] Thu, 19 March 2009 08:43 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Quote:

I am trying, from within an when-validate-item or when-validate-record to know (form runtime system variables :system) which object fired the latter trigger in order to either go along with validation or short-circuit this process.


Trust me, you don't want to do that.
I've seen people try it and it always causes grief.
The problem is that your buttons are kicking off validation at all.

So:

What code is in these buttons?
Are they in the same datablock as the rows you're trying to affect?
Why not just use the default menu commands?
Re: Track back triggering button in when-validate-(record/item) [message #392985 is a reply to message #392851] Thu, 19 March 2009 22:06 Go to previous messageGo to next message
didiera
Messages: 134
Registered: August 2007
Location: Mauritius
Senior Member
Hello,

In fact it's just as I feared : some scabrous endeavor. The buttons in fact are not on the same block as the fields, and in fact it's why the validation triggers. Moreover in one case the code in the buttons even does a go_block so things get really complicated. I think I will put this aside and rather thing of a reshuffle of fields or something of the kind. I was considering moving this part of validation at another time. Maybe under my save button. PLease confirm though that the when-validate-record is higher up on the flow when a button from another block is clicked.

thanks anyway.
Didier
Re: Track back triggering button in when-validate-(record/item) [message #393076 is a reply to message #392796] Fri, 20 March 2009 04:45 Go to previous messageGo to next message
didiera
Messages: 134
Registered: August 2007
Location: Mauritius
Senior Member
Hello again,

Indeed you were right. I found a safer and more easy workaround. So to recap and for those who might find this trick handy : I have a block for which I validate fields at record-level via a when-validate-record which does all the testing and stuff and which prevents anything else to happen whenever some field is wrong. My problem was that, the block has so many fields that I split it on two canvasses. The user switched canvasses by clicking on a button from a control block to move on to the next batch of fields for a single record. But the problem was that in some cases, related fields were split on these two canvasses and provided I chose some value for a given field, validation expected some restricted value for a counterpart on the other canvas... hence the user had to navigate there...but the problem in fact was that this is done through that button (whose click triggered the when-validate-record)...so crash! I know that was a stupid idea but has to do it that way. So what I did was to move the part of when-validate-record resposible for checking this field to a procedure and placing calls to the latter procedure in my key-nxtrec, key-down and 'new' buttons so the functionnality remained and the user could navigate to the extra canvas to put whatever data required.

kinda complicated but it's not.

regards,
Didier
Re: Track back triggering button in when-validate-(record/item) [message #394926 is a reply to message #393076] Mon, 30 March 2009 18:44 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you solved your problem?

David
Re: Track back triggering button in when-validate-(record/item) [message #394960 is a reply to message #394926] Mon, 30 March 2009 22:18 Go to previous message
didiera
Messages: 134
Registered: August 2007
Location: Mauritius
Senior Member
Hello,

Yes I actually implemented a workaround as explained. Thanks for asking.

regards,
Didier
Previous Topic: Populate detail block
Next Topic: Forms 6i Supports Multilingual - Simplified Chinese
Goto Forum:
  


Current Time: Fri Sep 20 12:21:47 CDT 2024