Field Validation (onchange, onblur, onkeydown)

Forums Requests Field Validation (onchange, onblur, onkeydown)

Viewing 2 reply threads
  • Author
    Posts
    • #27671
      Ross
      Participant

      Hi Alex,

      Overview

      I would like to request a feature that allows users to create field validation with more utility than the out of the box column validation.

      Use Case

      The requirement to ensure that form data entered is valid and reduce the risk wherever possible for user error.

      Solution Example

      Adding a Backend DFFS tab with the ability to select a field, event trigger and function to allow users to validation and return a message, true or false and display under the fields.

      I have attached a basic mockup. The following could be used as a user created function to validate fields.

      const validateTitle = () => {
        // Get Field Value
        const title = getFieldValue("Title");
      
        // Perform some type of validation check
        if (title.length < 7 || title.length >= 10) {
          // Return a message as a string
          return "Title must be between 7 to 10 characters";
      
          // Alternative, return true for a default message of "Field validation failed, please try again..."
        } else {
          // Return false to pass validation (would probably make more sense to return true,
          // but I think this provides the least amount of code.)
          return false;
        }
      };

      If there is anything else I can provide please let me know and apologies if I have missed a feature already listed in the forums.

      Cheers,

      • This topic was modified 4 years, 5 months ago by Ross.
    • #27692
      Alexander Bautz
      Keymaster

      Good idea, I’ll see if I can add something similar in the next version. I think I might just add it to the rules as a new “operator” like “validate with custom function” so you can create a rule and specify a validation function that you add in Custom JS.

      This way your validation can use all the rule trigger functionality in case it does not validate.

      Alexander

      • #27697
        Ross
        Participant

        Hi Alex,

        Thanks for the response and having it in rules makes sense.

        If you do get around to doing this and need some testing of it, let me know.

        Cheers

    • #27778
      Alexander Bautz
      Keymaster

      I have added this as a new operator – select a text or number field from the “If this triger” field and select the operator “validate with custom Function”. See help icons on the operator field for an example.

      You find the new version here: https://spjsblog.com/2019/11/28/dffs-package-updated-to-v4-4-4-16/

      Alexander

Viewing 2 reply threads
  • You must be logged in to reply to this topic.