Validation By Click or Tab is different??

aandriesaandries Member Posts: 8
(simplified test example)

In a default cronus database I have added a new field to T37 - Sale Line, field = Qty2 (integer)

Code after this field:
Qty2 - OnValidate()
IF "Qty2" > 10 THEN
  ERROR('Greater than 10');

I added this field on the sales line subform.

When I change this field (on the form) to 20 and give an enter or tab, to validate the field, the error appears once (what is good).

When I give not an error or tab, but click somewhere else in de subForm to validate the field, the error appears twice! (not good, should only be once).


While debugging I can seem to find anything strange. The call stack only shows the OnValidate trigger of field.
The OnValidate trigger is triggered twice, for the same record, same CurrFieldNo.


Does anyone knows how I can make sure the error comes only once, even if the user clicks to validate??

thanks!

Comments

  • ara3nara3n Member Posts: 9,256
    This looks like an executable bug if this truly happens that way.

    You are saying that you have to click OK Twice, if you click somewhere else with your mouse?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • aandriesaandries Member Posts: 8
    ara3n wrote:
    You are saying that you have to click OK Twice, if you click somewhere else with your mouse?

    That's right.
  • matttraxmatttrax Member Posts: 2,309
    By definition an error stops the rest of the code from executing. So you shouldn't be able to display two errors in one run of code. A message and then an error, sure, but not two errors. Sounds like a :bug: to me.
  • aandriesaandries Member Posts: 8
    matttrax wrote:
    By definition an error stops the rest of the code from executing. So you shouldn't be able to display two errors in one run of code. A message and then an error, sure, but not two errors. Sounds like a :bug: to me.

    Totally agree ...
    A default NAV bug then ... :cry:
  • BeliasBelias Member Posts: 2,998
    hey guys, didn't you all really know about this?!?! :-k
    you can encounter the same behaviour in every version of nav: just try to do it by inserting a wrong item on sales lines...tab=single error; click=double error...
    This have been solved in nav 2009sp1/RTC (well, this is pretty obvious :D )
    P.S.: as you can imagine, the code under the trigger is NOT executed twice, the only problem is the double error
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • matttraxmatttrax Member Posts: 2,309
    I'm not sure I've ever clicked somewhere to validate a field. I always use tab.
  • ara3nara3n Member Posts: 9,256
    Since the solution is to use the new executables and those were fixed in 2009 sp1, and MS does not support executable upgrades, You have to do full upgrade to 2009 sp1. :)
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • BeliasBelias Member Posts: 2,998
    i found it in the first period of working in nav...now i only do it when i have to click on some menubutton...and this "feature" is pretty annoying (for "fixed in 2009 sp1" i mean that as rtc -3 tier- manages these errors in a different way, the double error does not pop up,Classic client is still bugged)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.