Hi there
I want to test on the modify event of a table if a value entered is valid, if not I want to set the focus back to that field containing the invalid value and don't allow user to continue, unless he cancel the entry. The error statement causes a rollback and the all will be lost, so this is not a solution.
Is the something in Navision that I can use similar to Foxpro's "setfocus" command?
Thanks
Irene
Irene Grassow
0
Answers
What happens if you put your validation code in the OnValidate trigger of the field ?
Regards,
dkone.
So, when the criteria is not met or the field is empty, a message must be displayed and the focus must stay on that field.
Is this possible in Navision?
Thanks
You can Use Activate/Deactivate trigger on form to catch when user leaves a field.
Something like this :
But validation code should be on table not on form.
Regards.
Dkone.
I've placed all my other code on the table instead of the form, but cannot find a way to force a field to keep the focus.
Thanks
Surely there must be something in Navision that allows you to manipluate the focus.
Thanks
But if i where you, i'll do it in another way, more "Nav compliant".
Trying to set and force focus is not the best solution : if you put your logic in the form what about an record created outside this form (by a report, a dataport,... ).
Some other ways :
- Put a boolean field "Validated" on your table that should be true to make the record ok. Put your validation code in the OnValidate of this field.
- Look at the "DelayedInsert" property on a form, and put validation code on "OnInsert Trigger"
- You can also look for 'mandatory fields' in this forum for further informations.
Irene,
Don't do this.
Train the users to do it the Navision way. Ask them why they bought Navision in the first place. If they need FoxPro functionality they should have had a custom system developed in FoxPro.
You are heading down a very long and dangerous path this way.
<edit - added the quote to make it clear what I am replying to>
I said something wrong ?
Regards,
dkone.
:?: :?: :?: :?:
My post was addressed to Irene, not you.
OK I edited my original post to make it more clear. Sorry for the confusion.
Thanks for all you help!
Irene
=D> =D> =D> =D> =D> =D>
Excellent decision.
Just a comment. Don't call your field "Error", give it some other name.
If you call it Error, you wont be able to trow an ERROR on the table, because it confuses the field with the command.
Salut!
Author of the book Implementing Dynamics NAV 2013
Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
Irene