| |
| Publicado el 08,diciembre 2014 - 07:05 |
Hi All,
I am using windev 17 and developing a project which contains multiple forms. My question is how can i make a field mandatory for validation.
Actually what i want to do is that my form should not insert data into table if that particular field is empty. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 07:53 |
Hello Nimesh
It will help if we get some definitions in place.
Windev has data files and they have fields to hold data. In other languages these may be referred to as Tables, but in Windev, a table is a grid control on a window. When you refer to "forms" these are called "windows" in Windev.
Windows may also have a variety of editable controls to collect data. An edit control on a window can be made mandatory or not as part of its setup in the "Details" tab of the control editor or you can code the requirement in the exit code of the control.
It may help you to work through some of the training exercises that come with Windev.
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 08:01 |
Hi All,
Thanks for your help. It works.
Regards, |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 08:10 |
Hi Al,
Kindly suggest that how can we make combo box a mandatory field.
Thanks in advance.
Regards. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 08:39 |
Hello Nimesh
You can use the "Details" tab of the control editor and making the combobox "editable". You can then tick the "Mandatory Input" option.
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 08:55 |
Hi Al,
Thanks for reply. However its not working as the combo box is showing placeholder "Mandatory Input" and submitting the window containing no value.
Thanks. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 08,diciembre 2014 - 09:47 |
Hi, the most practical way is to enter a validation procedure just before saving the record to the file by e.g. ScreenToFile() command or, which is more or less the same, in the button [OK] when the user saves the record to the file. There, you will be able to do things like
MyValidationProcedure() // validation of controls before saving the record
IF MyCombo = 0 then ReturnToCapture(MyCombo) END
or
IF MyStartDate < "20140101" THEN ReturnToCapture(MyStartDate) END
RETURN etc
It's a place where you have an overview of all of the validation for that window. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,diciembre 2014 - 10:15 |
Hi All,
Any update about making a combobox a mandatory field.
Regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,diciembre 2014 - 10:17 |
| Did you read my posting?? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,diciembre 2014 - 10:41 |
Hi Guenter ,
I had gone through your post but thats not working for me as i am very new to windev.
I will be grateful if you can elaborate with example. That might work for me.
Regards |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 1 mensaje |
|
| Publicado el 09,diciembre 2014 - 11:50 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,diciembre 2014 - 13:24 |
All that you have to do is check that a valid item is selected in the combo box using something like this: if combo_mycombo..StoredValue <= 0 then Info("Please select an Item from ComboBox") ReturnToCapture(combo_mycombo) RETURN end HTH
Yogi Yang |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,diciembre 2014 - 14:09 |
Hi Nimesh
considering the kind of questions you are asking, I could not advise you enough to start by studying the tutorial that comes with windev. It will teach you all the basics things you are asking now and much more, and will save you TONS of time in the long run
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,diciembre 2014 - 17:49 |
Hi Nimesh
Fabrice says it all and it is stated in the tutorial of windev as well. You have to get familiar with the coding in windev for if your applications get bigger then coding is where you going to spent moast of your time.
Just do the tutorial. Donnot read it, do the coding as well ..Doing the code is the best way to get familiar and remeber how things work
The good thing is you choose windev. It has a great lanquage. The W language is one of the simplest languages arround. Simple yet verry powerfull.
regards
Allard |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,diciembre 2014 - 07:15 |
Hi Yogi,
I tried this but still the same situation as it works only when any action on combo box is taken while when i validate the window this check does not works for me.
Kindly suggest.
Regards, |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,diciembre 2014 - 08:18 |
My dear, I gave you an example and you don't understand it. So what to do with you? I recommend - before doing any programming - to:
1 - go through most of the tutorial until you understand it. 2 - use RAD11 (find the switch to turn it on) and do a full RAD generation for a small project and analyse the resulting code. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,diciembre 2014 - 20:27 |
Hi Nimesh,
The first treshold is always the highest.
I assume you have an OK button (a validation button) in your form window, a button that writes the contents of the controls (fields) into the file?
If yes, then you write the test code (as shown by Guenter and Yogi) in that button as its first code, before moving the field values to the file. Then the data will not be written, if the combo = 0.
Or, you can write the test code to a separate procedure, and call that procedure from the beginning of the OK button (and from elsewhere, if necessary, such as the exit code of the mandatory fields).
If you don't have an OK button, then maybe you should have one...
But anyways, you should do like everybody is telling you and RTFT (= Read The F...ing Tutorial:))
Best regards Ola |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 06:45 |
Hi Ola,
Thanks for reply, I already tried the code but my combo name "COMBO_Supervisorid" is showing compilation error when i put the code on button however if i put this code on combo it does not show any error but doesn't works also.
Thanks |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 08:23 |
| Nimesh, we can give you hints for how to solve your problem. But we cannot - and definitely will not - write your program for you. That's your job. If you are not willing to really read and understand the given answers and stubbornly insist that some magic will point the user to a combo which has not been touched by her/him then, sorry, we cannot help you! |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 10:45 |
Hi
I Agree with Guenter.
An other thing is. If you want us to help then be as specific as possible. What you discribe has many implementations to mutch to mention, why? Because Windev is a programming tool and eventhough pcsoft states it is a 5gl it is not a point and click wizzard.
Just a view options you can fill with a querie or a file you can bind the controls to the analisis or not bind and do it all by programming.
Till we know what you exacly want then we can be of help. If we donnot know what exacly you want you cannot expect us to give you a solution.
Again what you want is verry basic stuff. If you taken the tine to read and do the first 50 pages of the tutorial you will moast problebly be able to do it all yourself.
Allard |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 12:08 |
Guenter
I know that there is no magic is gonna happen but I am sorry to say that but really i am really not expecting any solution or any reply from you and i was discussing with OLA because he replied on the post. I had not asked you to suggest or interfere if you can't help. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 12:15 |
Hi Allard,
Actually it is very basic thing to do i reckon but i am doing preliminary things in windev because i am very new to windev actually whats the problem is to make a combobox a mandatory field and in my case i am not able to do it as i tried programming and all operations i knew and read the tutorial thoroughly also. There is nothing mentioned in tutorial about it.
Thanks for asking |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 12:46 |
Hello Nimesh
You just have to apply basic program language learning principles to the problem.
Step 1 Read all about the debugger and the info() command Step 2. Open the Unit Example on combo boxes and using the debugger, the STOP command and the Info() command teach yourself what happens in each event of the combobox as it executes. Use the info() command to send yourself a message as each event triggers so in the exit event, insert Info("Exit") followed by the STOP command - do this in each code event. This will show you which event is triggering and stop the execution so you can inspect the values and trace the code execution.
Once you learn how the code events of the combobox work and see the values returned as the code executes, you will understand how to use the examples and suggestions in this thread.
There is nothing more that we can do for you here, it is up to you.
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 13:31 |
Quote Nimesh
Guenter
I know that there is no magic is gonna happen but I am sorry to say that but really i am really not expecting any solution or any reply from you and i was discussing with OLA because he replied on the post. I had not asked you to suggest or interfere if you can't help.
Nimesh Being rude or offensive to any member on here is NOT acceptable and will certainly not encourage people to help you. Guenter is one of the longest standing members on this forum with a considerable knowledge of WD - His advice/comments will always be valid and should not be dismissed.
If as you say you have done the tutorials then you will already know that you cannot set a combo as mandatory either in the tab screen or by programming. Many here have already given you the methods of checking if a selection has been made or not and Al has supplemented that with with advise on using the debugger.
You can visually indicate that a control is required by using the EyeMagnet option or changing a colour using Events - Of course you will still need to validate the control prior to saving the record.
Finally be careful about using mandatory fields - in the real world users will put anything in (tell lies) just to get past the restriction and in that case you will have to have a validation routine for the content. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 17:10 |
Hi Nimesh,
I have no idea about your programming skills or base programming knowledge or education...
If you're looking for a power user MSAccess like solution in WinDev, you will be disappointed. WX is a real development platform.
However, you might have a look on http://www.wxlive.us Webinar #129 from October 17 2014. Somewhere in the middle a class method is shown to serve as a validation routine.
Of course this method could be a simple procedure in a non OO environment as well. That would be working on the in memory db-context updated with the ScreenToFile() function (Procedural programming) instead of the class members updated with the ScreenToSource() function (OO programming).
The framework shown in that video with a complete sample can be downloaded at <a class="ExternalLink" rel="nofollow" target="_blank" href="http://repository.windev.com/resource.awp?file_id=91;wxframework-open-source-oop-multiplatform-framework-allows-rapid-development-wdwb-and-later">http://repository.windev.com/resource.awp…</a>
If I am not mistaking, there are combo boxes in there that are being validated.
Cheers,
Peter H. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 11,diciembre 2014 - 21:16 |
Hi Nimesh
Without seeing all the code in the combo control and in the validation process and the text of the error message it is impossible to help you any better than the forum has done so far.
HOWEVER... ...it is also possible that the code is correct, but Windev has lost its marbles because of its internal spaghetti problems. It would not be the first time. Sometimes even the simpliest things can cause weird problems because Windev just has gone mad.
So, just to make sure that Windev works properly, it would not do any harm to delete the Appname.cpl subdirectory below the app's main directory, then recompile the project and then re-test the problem code.
Best regards Ola
P.S. In the Combo help there is reference to several example apps which show different ways to use combo controls. Have you studied them?
P.S.2. Compared to separate lookup table windows combos may be more restricted, more difficult and more problematic. I use a combo only for selecting from a very small amount of non-changing fixed data. If the selection data may change, then I put it in a file, and select it from a table window rather than a combo. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 12,diciembre 2014 - 06:52 |
Hi Derek,
I am not intending of being rude or offensive to anyone but just want to explain that i was replying in the same way that i was replied and i am apologized if i was.
Thanks |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,diciembre 2014 - 07:04 |
Hi All,
Thanks for the support. Job Done. Many thanks to you all.
Regards, |
| |
| |
| | | |
|
| | |