How don't let left a form if a field is not informed

LeroyLeroy Member Posts: 199
Dear folks, I this this is easy. On OnCloseForm from a form I've the code:

IF field1='' THEN ERROR:='Field field1 is empty, you must fill it';

This message shows when you try to left the form and fild1 is not informed. But this contro let to left the form. I'd like to know how do it that don't let left the form is the fild is not informed.
Thanks.

Comments

  • kinekine Member Posts: 12,562
    I recommend to not use such a way formaking some fields "required". Search the forum for that, you will find many posts about this...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • LeroyLeroy Member Posts: 199
    Thanks for recomendation, but I need it, do you know how. please?
  • UdAkunuriUdAkunuri Member Posts: 31
    Use OnQueryCloseForm Trigger, it will solve your problem.
    Thanks & Regards,
    Udaykumar Akunuri
  • LeroyLeroy Member Posts: 199
    Perfect!!, it just work. Thanks both for help.
  • kinekine Member Posts: 12,562
    And what about the PgUp, PgDown, listing in the entries etc. The user still can move to another record and not fill in the field...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • LeroyLeroy Member Posts: 199
    Yes you're right, normally this control will be in a form that access though another, I mean that there will be a filter; it's true that you can deselect the filter; but this is only and advise control to remember to fill fields, in my case the final responsability will be form the user.
    Thanks also for your concern.
  • UdAkunuriUdAkunuri Member Posts: 31
    For that also you can write code, While closing the form - Instead of checking the current record we will check all the records..............

    Repeat
    testfield(",,,,,");
    unitl next = 0;
    Thanks & Regards,
    Udaykumar Akunuri
  • kinekine Member Posts: 12,562
    Please NOOO [-X . Can you imagine to go through whole table with tousends record just to find that all is ok when anybody close the form?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • UdAkunuriUdAkunuri Member Posts: 31
    Hi Kine,

    You are Right, it is not a good thing if we have thousands of records(as you said). But according to my knowledge there will not be thousand of records in a form - In which a user need to feed the data......... i.e, we have only few types of tables (Master, Subsidery, Suplimentary, journal, Ledger, Documents,.......)

    Correct me if i am wrong. ( i am also interesting to know where i need to improve)
    Thanks & Regards,
    Udaykumar Akunuri
  • kinekine Member Posts: 12,562
    Still, functionality "assuming" something is not good one. Right now, the assumption can be correct. Can you be sure that it would be still true in few years? Ways like "blocking" the record (e.g. not alowing users to "unblock" the customer until all data are ok) from using it in related processes until the data are correctly filled in is much better and there are no performance consequences and there are no problems with users looking to the card, which e.g. cannot edit the record (because have no permissions or are not responsible for that) and are blocked by error, which is vey annoying for them (because they cannot close the form, but they cannot solve the problem and needs to kill the client to leave the form).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • UdAkunuriUdAkunuri Member Posts: 31
    You are right Kine,

    This depends on the situation and need. As Leroy told that 'he need it', i gave this way(may be a solution).

    Thank you
    Thanks & Regards,
    Udaykumar Akunuri
  • kinekine Member Posts: 12,562
    For me, in most cases words "I need" or "They need" means "I/they do not know any other way how to do that". It means that offering different ways of solution even if somebody told you "I need that" can lead to solution in the alternative way (if he is listening and open). 8)

    Mr. House: "Everybody lies" :mrgreen:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.