Form Focus

mb6606
Member Posts: 30
Variables:
Purchase Line."no."
Text2 var code
Code:
On the ONVALIDATE section of field Purchase Line."no."
If Purchase Line."no.">5 then
currform.activate.text2
IT seems so simple but does not work. The cursor remains in the Purchase Line."no." field
I have no nextcontrols set. Anybody know why???
Purchase Line."no."
Text2 var code
Code:
On the ONVALIDATE section of field Purchase Line."no."
If Purchase Line."no.">5 then
currform.activate.text2
IT seems so simple but does not work. The cursor remains in the Purchase Line."no." field
I have no nextcontrols set. Anybody know why???
0
Comments
-
What are you trying to do?David Singleton0
-
I am trying to get the form focus to jump from one field to another field
onvalidate based on an if then statment.0 -
if the "Item No." (Field "No.") on your line is greater then 5 :?: you want to jump to field Text2 after an validation of the field "No." :?: This will not work on SQL if you insert an 400. For the sql sorting, the 400 is smaller then the 5 (reason: It's not an integer field, No. is an Char field)
Correct :?:Do you make it right, it works too!0 -
well No. is code and 5 is integer, so no way this will even compile.David Singleton0
-
David Singleton wrote:well No. is code and 5 is integer, so no way this will even compile.
thats also ;-)Do you make it right, it works too!0 -
David Singleton wrote:no way this will even compile.0
-
I simply want to change focus from field1 to field2 using the code currform.field2.activate in the onvalidate section of field1. The cursor should jump focus to field2 but it remains in field1.0
-
you can set the nextControl property or you write behind
Field1 - OnAfterValidate() if COndition then //<-- if needed CurrForm.Field2.activate();
RegardsDo you make it right, it works too!0 -
garak wrote:you can set the nextControl property or you write behind
Field1 - OnAfterValidate() if COndition then //<-- if needed CurrForm.Field2.activate();
Regards
section the code has no effect. The Nextcontrol is undefined.0 -
doesn't work it (your if Condition is correct)) if you press ENTER or TAB but it works if you press the Courser Buttons?Do you make it right, it works too!0
-
Hi,
You need to take into account the sequence that Nav fires triggers and excutates actions. What happens is that the field validates and then you issue the command to activate the second field (field2). Nav does this but then the action after the validate is to go the next field ( of the cative field) which is the NextControl of field2
For example to get the sales order subform to return to the description field from the quantity field if the quantity is greater than 5 you would need to add in the OnValidate trigger :
IF Quantity > 5 THEN
CurrForm."No.".ACTIVATE;0 -
DaveT wrote:Hi,
You need to take into account the sequence that Nav fires triggers and excutates actions. What happens is that the field validates and then you issue the command to activate the second field (field2). Nav does this but then the action after the validate is to go the next field ( of the cative field) which is the NextControl of field2
For example to get the sales order subform to return to the description field from the quantity field if the quantity is greater than 5 you would need to add in the OnValidate trigger :
IF Quantity > 5 THEN
CurrForm."No.".ACTIVATE;
Yes exactly what I am attempting to accomplish. Yet the cursor remians focused in the QTY field. IT does not jump to the description field. Even when I create simple test form I cannot get the focus to change unless I use nextcontrol.0 -
Belias wrote:try to get rid of your "if" statement for now: in other words, do the "activate" every time.
if it works, then your condition has something wrong, otherwise, try to change the trigger
Even if I create a simple test form with NO,DESC,QTY and no controls and no code and then add code to the onvalidate tigger of NO field the code
CURRFORM.QTY.ACTIVATE;
The focus should jump to the QTY field yet remains in the no field.0 -
which nav version?
it MUST work (as it works for me and everyone else i think)
try to name your textboxes (i literally mean "name" property of the textboxes), and then use currform.nameoftextbox.activate
this is to check if you're calling the wrong control.
anyway, did you try to comment the "if" statement, leaving only the "activate" instruction?0 -
Belias wrote:which nav version?
it MUST work (as it works for me and everyone else i think)
try to name your textboxes (i literally mean "name" property of the textboxes), and then use currform.nameoftextbox.activate
this is to check if you're calling the wrong control.
anyway, did you try to comment the "if" statement, leaving only the "activate" instruction?
I am using v3.6
I had removed the "IF" statement in my previous code testing.
Perhaps the ZUP file is causing this problem? The currform.activate does work on the onactivate tigger and the drilldown triggers. It will not work on the onvalidate or onaftervalidate triggers. If I try on the onformat section it crashes Navision.
Could be Navision v3.6 problem as this is very simple code.0 -
no, not a bug of 3.60...it works on my 3.60 sql db...
have you got some other code under the onvalidate of the table or the form?which code?
did you check the properties?is the destination field focusable(this is really stupid but who knows)?is it on the same tab?(i don' remember if the activate works across different tabs)
well, i think your problem is a nondefault property or some code under validates...i cannot try guess more than this!0 -
Belias wrote:no, not a bug of 3.60...it works on my 3.60 sql db...
have you got some other code under the onvalidate of the table or the form?which code?
did you check the properties?is the destination field focusable(this is really stupid but who knows)?is it on the same tab?(i don' remember if the activate works across different tabs)
well, i think your problem is a nondefault property or some code under validates...i cannot try guess more than this!
Yes I even created a new table and form with zero code. onvalidate - Currform.var1.activate now jumps the focus to the HELP button. I know Navision forms has bugs this must be another.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions