Form Validation
Kc_Nirvana
Member Posts: 146
Hello....
I've searched the forum but i didn't found solution for my problem...
In Vendor Card:
I want that if the address is blank then appears a confirm windows that shows the user if he wants to continue or not.
If choose not then stay on the record, if choose yes then go to next or previous record, insert.... the normal behavior of the form.
Can someone help me with this problem?
I've searched the forum but i didn't found solution for my problem...
In Vendor Card:
I want that if the address is blank then appears a confirm windows that shows the user if he wants to continue or not.
If choose not then stay on the record, if choose yes then go to next or previous record, insert.... the normal behavior of the form.
Can someone help me with this problem?
Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit
0
Answers
-
How & when do you want this "Check" to occur? When they try to leave the record?
do you want some kind of mandatory field validation to occur?
PS: You should try to use table validation whereever possible.0 -
On the exit of the form it's easy.....
The OnQueryCloseForm() solves my problem.
But on the other "movements", it's hell.....
One example:
I'm in Vendor Card No. F001
The address is blank, but i want to move to the next record...
It should appear one dialog that says "The address is not fill. Want to continue?"
If the user says yes, it goes to the next record, if it says no it stays on the No. F001
Do you understand my big problem?
I want that in moving records and create new........Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit0 -
-
DenSter wrote:Get in touch with your partner and ask them to do this for you.
????????
I am the developer of the company partner......
Don't understant what your purpose with that answer..............Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit0 -
oh you ARE the partner, that surprises me very much
In NAV you don't have save actions, as you know, so you can't easily catch that event on a form level. You shouldn't even do ANY data validation on a form level to begin with, that is definitely not the right place to put validation code. So instead of trying to make the system do something that it was never designed to do, you think about what the system IS designed to do. Think along the lines of how the system usually works with data validation and when checks are performed.
I would personally go along the lines of adding this check to the release process, and not allow an order to be released with an empty address.0 -
DenSter wrote:oh you ARE the partner, that surprises me very much
Don't know why are you so suprised.....
Do you know why i love Navision?
Because it does whatever you want to do....
By one mean or the other, it does always what you pretend to do.....DenSter wrote:In NAV you don't have save actions, as you know, so you can't easily catch that event on a form level. You shouldn't even do ANY data validation on a form level to begin with, that is definitely not the right place to put validation code. So instead of trying to make the system do something that it was never designed to do, you think about what the system IS designed to do. Think along the lines of how the system usually works with data validation and when checks are performed.
I would personally go along the lines of adding this check to the release process, and not allow an order to be released with an empty address.
But this is an anormal exception....
I don't want the fields to be true validated, I want only one warning to the user, nothing else......Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit0 -
Does it really matter WHAT you are doing? You're checking the value of a field, which is what validation is. Validation of data should NEVER be on a form level.0
-
Personally Warnings only work for a short time. Soon enough they are just going to click it away.
Ignoring the message. It's hard to program when it's "sometimes OK" to do one thing or another.
Best to either make the address field mandatory or not.0 -
Hi,
As many NAV developpers, I have worked on this topic but did not found out the perfect solution. Using the form triggers, there is always a way to insert a record without the requested datas.
From my experience, there are two ways to deal with mandatory fields :
1°) Use a Vendor creation Card. This card could be running on a temporary record (have a look to the Todo creation process in the NAV CRM Module). From the card, a posting function perform the field value checks, and insert the record in the table if no errors occured. A bit of development to Do...
2°) Block the vendor as long as the requested field are to filled (using the standard "blocked" field). If the fields are not filled, no one could use the vendor in an order or in general journal lines... which make the fields mandatory (in a way).
Hope that helps...0 -
I have found that when you must absolutely control data entry on a form, you need to first remove some of the standard navigation features that are built into Navision. This can be quite easy to do on a form, at least in classic client, by creating an unbound form (i.e. leave the SourceTable property of the form blank). With an unbound form, there is no record associated with it so there is nowhere that the user can navigate. Their only option is to close the form or use the controls that you provide. You will have to take care of all navigation and record retrieval/maintenance but you are completely in control of the data and can prevent it from being saved until all criteria is met.
It is definitely not "standard Navision practice" and should be avoided for many reasons. But, it CAN be done. And it's why I have come to like Navision so much as well. It can do almost anything!0 -
Thank you all.....
I've come to a solution that best apply for what i want to do......
A new functionfValidateMandatoryFields(Occur : 'OnForm,ExitForm') blnReturn : Boolean CASE Occur OF Occur::OnForm: IF xRec.HotspotId<>0 THEN IF xRec.HotspotId <> Rec.HotspotId THEN IF(xRec.ComercialName = '') OR (xRec.Location_Id = '') OR (xRec.SSID= '') OR (xRec.Active_Status= '') OR (xRec.Supported_Modes='') THEN blnReturn:= NOT CONFIRM(TextFields); Occur::ExitForm: BEGIN blnReturn:=TRUE; IF(xRec.ComercialName = '') OR (xRec.Location_Id = '') OR (xRec.SSID= '') OR (xRec.Active_Status= '') OR (xRec.Supported_Modes='') THEN blnReturn:=CONFIRM(TextFields); END; END;
That will trigger onForm - OnNewRecord IF NOT BelowxRec THEN IF fValidateMandatoryFields(0) THEN BEGIN SETPOSITION(xRec.GETPOSITION); CurrForm.UPDATE(FALSE); END;Form - OnAfterGetRecord IF NOT gIsDeleted THEN IF fValidateMandatoryFields(0) THEN BEGIN SETPOSITION(xRec.GETPOSITION); CurrForm.UPDATE(FALSE); END; gIsDeleted:=FALSE;Form - OnQueryCloseForm EXIT(fValidateMandatoryFields(1));
In Navision V4, the OnNewRecord doens't work because the CurrForm.Update
Thank you all for all the suggests......Junior Consultant & Developer in Dynamics NAV
"I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end"
Nirvana - Nevermind - Smells Like Teen Spirit0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 333 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

