• Resolved hheyhey568

    (@hheyhey568)


    Hello team,
    Is there a way to handle the error?
    In my calculation , sometimes if the user gives wrong input , the calculation returns either blank or NaN.

    When this happens , I would like to inform user that there is error in any of the input and to check the inputs.

    For example : Calculated fieldname10 becomes NaN or blank due to wrong input in fieldname1. So I want to inform user at fieldname1 to check input. Also at fieldname10, I don’t want to see NaN but warning message to check input.

    Regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @hheyhey568

    You can use an if conditional statement or IF operation in the equation to check the fieldname1 value.

    For example, assuming you have implemented the equation fieldname2/fieldname1. In mathematics, the division by zero generates an error. So, you can check the fieldname1 value:

    IF(fieldname1, fieldname2/fieldname1, '')

    Or you can check the result:

    (function(){
    var result = fieldname2/fieldname1;
    return IF(NOT(isNaN(result)), result, '');
    })()

    Best regards.

    Thread Starter hheyhey568

    (@hheyhey568)

    Thanks a lot.

    Can we give warning message on below the fieldname1 to user that “ check the input value” so that user enter the correct value ?

    Pls help

    Regards,

    Plugin Author codepeople

    (@codepeople)

    Hello @hheyhey568

    Yes, of course. You can control everything.

    For example, you can insert an “Instruct. Text” field with the information you want. Assuming the field’s name is fieldname123.

    And then, edit the equation as follows:

    (function(){
        var result = fieldname2/fieldname1;
        if(NOT(isNaN(result)))
        {
            IGNOREFIELD(123);
            return result;
        }
        else
        {
            ACTIVATEFIELD(123);
            return '';
        }
    })()

    Note that you should replace 123 with the numeric component in the name of your “Instruct. Text” field.

    Best regards.

    Thread Starter hheyhey568

    (@hheyhey568)

    Hello Team ,
    Thanks for the help.

    Can I make this instruct field with different colour like red that user can be warned?

    regards,

    Plugin Author codepeople

    (@codepeople)

    Hello @hheyhey568

    Yes, that’s possible. Please, follow the steps below:

    1. Assign a custom class name to the “Instruct” field. For example, error-cls

    You assign class names to the fields through their attributes “Add CSS Layout Keywords”.

    2. Define the new class through the “Customize Form Design” attribute in the “Form Settings” tab (https://resources.developers4web.com/cff/images/documentation/form-settings-tab.png):

    #fbuilder .error-cls *{color:red !important;}

    More information about customizing the forms designs by reading the following posts in the plugin’s blog:

    https://cff.dwbooster.com/blog/2020/01/12/form-design

    https://cff.dwbooster.com/blog/2021/09/27/create-new-form-template

    Best regards.

    Thread Starter hheyhey568

    (@hheyhey568)

    Thanks a lot

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error handling’ is closed to new replies.