How appears a confirmation if a filed is changed

LeroyLeroy Member Posts: 199
Hello, I think this's easy. I want on a form that if a field is changed appears a confirmation message to do it or not. Now I've the following (it's incomplete).

IF xRec.Description<>'' THEN
BEGIN
IF CONFIRM(text0012,TRUE) THEN
........
IF CONFIRM(text0012,FALSE) THEN
............
END;

text0012 var = Are you sure you want to change this field?

How I can do that?.
Thanks in advance.

Comments

  • krikikriki Member, Moderator Posts: 9,110
    First and for all : WHY do you want that the user confirms it?
    Is it to avoid that the user changes some info by accident?
    In this case you can better put the form to non editable, and use a shortcut to make it editable.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • LeroyLeroy Member Posts: 199
    Thanks for reply. The "Description" field it's an example, really is another fields. The problem is that, from time to time, they change this filed; it's only for caution.
    Thanks in advance.
  • krikikriki Member, Moderator Posts: 9,110
    I think it is best you put it in the OnValidate-trigger of the table and not the form. Of course this means it will ALWAYS be triggered. I don't know if this is the idea.

    The code:
    IF (rec."The Field" <> xRec."The Field) and
        (CurrField = FIELDID("The Field")) THEN // this checks if the field is changed by the user and not by some other means
      IF NOT CONFIRM('Do you want to change the value from "%1" to "%2" in field "%3"?',false,
        rec."The Field",xRec."The Field,FIELDCAPTION("The Field")) THEN
        ERROR(''); // just raises an error but without message
    
    Of course it is best to use a constant instead of writing the text directly into the CONFIRM like I did.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • SavatageSavatage Member Posts: 7,142
    *Item Table*
    Description - OnValidate()
    ..
    ..
    **edit Kriki is more complex & covers all the bases too!**
    ERROR(''); // just raises an error but without message
    you could add ERROR("Press ESC to exit the field"); so the user is clear on their options
  • David_SingletonDavid_Singleton Member Posts: 5,479
    The question here, is which is better:

    a/ we give a bad solution, but one that the poster wants to hear and is happy with; or

    b/ we give the proper solution, knowing that the poster wont like it and will be disappointed with it.

    Is the proposed solution really the best solution?
    David Singleton
  • SavatageSavatage Member Posts: 7,142
    If I may guess at what the problem is (and it's a problem we had in the beginning too) is an inexperienced user start's typing over the description or other field expecting it "find" what they are looking for, except the forgot to hit the magnifiing glass first. then leave the record saying "oops" instead of hitting ESC and starting again.

    Our old solution was create a an Add/Change tab at the end of all the tabs. there we put the fields that might require changing from time to time. Then locking down all the other tabs so no overtyping would cause havoc. PLus it's not the default tab anyway, you would have to make an effort to go to that tab and actually make changes by accident.

    But with this type of solution "that they want" you'll have to put it on alot of fields & why stop there with item what about customer's, vendor's, etc.
  • idiotidiot Member Posts: 651
    I think all will agree the idea here is to make as little changes to the system as possible...
    In order to do that we need to evaluate things like:
    1. frequency of change
    2. no. of fields affected
    3. no. of users & their skillset/knowledge/training
    4. resources involved/required
    ...

    I have implemented 2 extreme cases which is not "recommended" & both my clients were happy because:
    1. They reduce the no. of mouse clicks
    2. It becomes intuitive
    ...
    NAV - Norton Anti Virus

    ERP Consultant (not just Navision) & Navision challenger
  • LeroyLeroy Member Posts: 199
    Thanks every body for help. Your indications have been very useful. It works ok. The users that have permisions for these fields can change them; this control is only to avoid accidentally changing with a mouse coup; in other cases may be isn't the best way but yes in this case.
    Thanks everybody for help.
Sign In or Register to comment.