checkbox check

mkpjsrmkpjsr Member Posts: 587
hi experts

suppose i am checking a check box and after checking it will check a condition .If the condition is not valid then uncheck the checkbox.plz guide me . mention the code.

Comments

  • KYDutchieKYDutchie Member Posts: 345
    Ok, this is simple, but I will not give you the complete code. Below is a template of what your code should look like and where to put it.

    On the Onvalidate trigger of your Boolean field in the table add your check.
    Your code should look something like this:
    IF <yourbooleanfield> THEN BEGIN
      IF not <your check> THEN BEGIN
        ERROR('Error Message');
      END;
    END;
    

    The ERROR command will automatically reset the entered value.

    I hope this helps.

    Regards,
    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • DakkonDakkon Member Posts: 192
    If you wish it to silently uncheck without an error message you can simply call ERROR('').

    Also you may be tempted to do something like the following:
    IF <yourbooleanfield> AND (NOT <your check>) THEN
        ERROR('Error Message');
    

    Don't do that, because Navision evaluates both sides of an AND operation even if the left evaluates FALSE. Of course, if your check procedure already checks to make sure the value in the boolean is true before running its logic, then you could safely condense the code to:
    IF NOT <your check> THEN
        ERROR('Error Message');
    

    It really depends on what you are doing.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
Sign In or Register to comment.