Validate Filed

Alkro
Member Posts: 115
Merry Christmas!!
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.
Is Possible?
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.
Is Possible?
0
Comments
-
Why should you want to do this? OnValidate code on field level is to 'enforce' business logic for that specific field.
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.0 -
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 TRUECem Karaer @ Pargesoft
Dynamics NAV Developer since 20050 -
cemkaraer wrote: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. :-#0 -
7. Don't forget to set boolean to FALSE in the OnCloseForm trigger.Cem Karaer @ Pargesoft
Dynamics NAV Developer since 20050
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