Topic: Compulsory field

How to make data entry in a particular text field compulsory ( eg: Mobile_No. or DOB.), before the form can be saved?

Re: Compulsory field

Hi,
Can you not just define any relevant fields as mandatory in your data structure - or are you meaning something else?
Derek.

3 (edited by sibprogsistem 2020-05-16 17:35:56)

Re: Compulsory field

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=6599&download=0.

Post's attachments

Attachment icon Безымянный.png 15.4 kb, 114 downloads since 2020-05-16 

Re: Compulsory field

Thank you, Derek and Sibprogsistem.
My database now already has data and setting a field to not null will require specifying a default value for the field. Then even if no data is entered in that field, the form will be saved with the default value. But  I need real data for the field. Deleting the present database and recreating it will involve a lot of work. Any simpler solution to prevent saving the form without data in a field, in an existing database?
Regards,
eyeman

Re: Compulsory field

.

Post's attachments

Attachment icon test.7z 2.9 kb, 250 downloads since 2020-05-18 

6 (edited by derek 2020-05-18 09:34:35)

Re: Compulsory field

Hi Eyeman Hi Sibprogsistem,
Another option, rather than delete the current database, is:
0.  Copy your entire project folder (just as a back-up- but I've never had a problem)
1.  Go to the relevant project folder
2.  Find and rename sqlite.db to xxxxx.db
3.  Go to your database schema in MVD
4.  Change any fields to mandatory  - no 'default' value is required.  Don't save or run your project yet.
5.  In the project folder, rename xxxxx.db back to sqlite.db
6.  Finally save/run your project.
Derek.

Re: Compulsory field

I could change the attribute of the field to "Not Null" by following the above steps. However, since there is a PageControl in the form the error message does not appear directly over the required field. Adding the suggested script positions the error message above the required field. So in a working database, a field may be made mandatory in both the ways, depending on the form controls. Now I get the desired result on clicking the Save button.
Thanks again, Derek and Sibprogsistem.
Regards,
Eyeman

Post's attachments

Attachment icon Not_Null.7z 152.18 kb, 254 downloads since 2020-05-18