I have one List Form and i want that when user puts a value in one field, Validate of this field in the table will not be execute. Only must be executed OnValidate of this field in the Form, not in table.
There is no simple way to solve it. Here is the workaround:
1. Create single instance codeunit
2. Create boolean variable in the CU
3. Create two functions in the CU, one for setting and the other for getting the boolean variable
4. Declare CU in the table and form
5. In the OnOpenForm trigger of the form, set the CU's boolean to TRUE
6. In the OnValidate trigger of the table get the boolean value of CU. Run the code of the OnValidate trigger if the boolean value is FALSE don't run if it is TRUE
Cem Karaer @ Pargesoft
Dynamics NAV Developer since 2005
There is no simple way to solve it. Here is the workaround:
1. Create single instance codeunit
2. Create boolean variable in the CU
3. Create two functions in the CU, one for setting and the other for getting the boolean variable
4. Declare CU in the table and form
5. In the OnOpenForm trigger of the form, set the CU's boolean to TRUE
6. In the OnValidate trigger of the table get the boolean value of CU. Run the code of the OnValidate trigger if the boolean value is FALSE don't run if it is TRUE
What about creating a variable that is of the same type as the field.
Then show this specific variable on the form and add code on that control instead of the table field. Handle the value (load / save from the record) and don't call the table validation. :-k
This could be an easy way.
But I strongly suggest you avoid this. Validation should be called. You must really really know the impacts of something like this. :-#
Comments
Nevertheless, as far as I know this is not possible (complying to standard NAV programming practice).
Raed more on validating date on my blog posts http://dynamicsuser.net/blogs/vanvugt/archive/2009/12/19/validating-data-user-input.aspx and http://dynamicsuser.net/blogs/vanvugt/archive/2009/12/19/validating-data-calling-validate.aspx.
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
1. Create single instance codeunit
2. Create boolean variable in the CU
3. Create two functions in the CU, one for setting and the other for getting the boolean variable
4. Declare CU in the table and form
5. In the OnOpenForm trigger of the form, set the CU's boolean to TRUE
6. In the OnValidate trigger of the table get the boolean value of CU. Run the code of the OnValidate trigger if the boolean value is FALSE don't run if it is TRUE
Dynamics NAV Developer since 2005
What about creating a variable that is of the same type as the field.
Then show this specific variable on the form and add code on that control instead of the table field. Handle the value (load / save from the record) and don't call the table validation. :-k
This could be an easy way.
But I strongly suggest you avoid this. Validation should be called. You must really really know the impacts of something like this. :-#
Dynamics NAV Developer since 2005