Skip to main content
Vijaykumar Gandi ha fatto una domanda in #Appexchage Apps

Hi All,      I have a FormAssembly form with two fields, Season Pass 1 – First Name and Season Pass 2 – First Name, and I need a validation or alert in the form to prevent users from entering the same name in both fields. The requirement is that the two names must be different, and if a user enters the same name in both fields, the form should display an error message or alert before submission. I have tried multiple approaches to implement this validation, but it is not working as expected.  @FormAssembly   

1 risposta
  1. 21 gen, 15:56

    I actually worked this out with Gemini(!)...I tried it and it works!...  

    To prevent a user from entering the same value in two fields (e.g., tfa_1 and tfa_2), follow these instructions to set up a "No-Code" validation system using a hidden calculation and conditional logic.

    1. The Validation Field (Field X)

    Create a text field that will act as the "logic engine." It is best to keep this field visible during testing and then hide it using CSS (class notext) rather than the "Hidden" checkbox to ensure logic triggers correctly.

    • Variable Setup: * Set tfa_1 as a variable named fieldOne.
      • Set tfa_2 as a variable named fieldTwo.
    • Calculation: Mark this field as a Calculated Field and use this formula: fieldOne == fieldTwo ? "DUPLICATE" : "OK"
    • Validation Rule: Add a Custom/Regular Expression rule to this field.
      • Pattern: /^OK$/
      • Error Message: "Field 1 and Field 2 cannot be the same."

    2. The Error Message Field

    If the built-in validation message doesn't display prominently enough, use a dedicated manual error message.

    • Field Type: Add a Text/HTML block or a Section immediately below the input fields.
    • Content: Enter a warning like: "Error: The values in these two fields must be unique."
    • Conditional Statement: Set a rule to Show this section only if the Validation Field (from Step 1) is equal to DUPLICATE.

    3. The Submit Button Logic

    This step ensures the user cannot bypass the error and submit the form anyway.

    • Conditional Statement: Apply a rule to the Submit Button (or the final section containing it).
    • Logic: Set the button to Hide (or Disable) if the Validation Field is equal to DUPLICATE.
0/9000