Skip to main content
Known Participant
Apr 21, 2023 8:13 AM UTC
Question

is it possible to pass multiple email address in one textbox and validate

in interface ,i  want a textbox in which i want to paste some mail addresses and then i need to validate those email address

    13 replies

    sanchitg0002
    Inspiring
    Apr 21, 2023 9:18 AM UTC

    Yes, but these emails must be separated by some delimiter.

    sanchitg0002
    Inspiring
    Apr 21, 2023 9:19 AM UTC

    a!localVariables(
      local!emails,
      local!invalidEmails: if(
        isnull(local!emails),
        {},
        joinarray(
          reject(
            isnull(_),
            a!forEach(
              items: split(local!emails, " "),
              expression: if(
                validateemailaddress(fv!item),
                null,
                fv!index
              )
            )
          ),
          ","
        )
      ),
      local!validation: if(
        isnull(local!invalidEmails),
        {},
        "Invalid email at " & local!invalidEmails & " position(s)"
      ),
      a!textField(
        label: "Enter emails",
        value: local!emails,
        saveInto: local!emails,
        validations: local!validation
      )
    )

    sabat0002Author
    Known Participant
    Apr 21, 2023 9:33 AM UTC

    Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'split' [line 7]: A null parameter has been passed as parameter 1.

    Can you please help me with this