Skip to main content
January 3, 2024
Question

Email validation

  • January 3, 2024
  • 2 replies
  • 0 views

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
  )
)

I want my email addresses validation each mail should be in one line otherwise throw an error and email format should be correct other wise throw an error.
( test@test.com
 test2@test.com
 test3@test.com


can someone help me with the code and how to store this email address in line by line in db

    2 replies

    mikes0011
    Brainy
    January 3, 2024

    Instead of starting a new thread, it would be better to update your existing one with any additional details - that preserves the Community front-page from getting overly cluttered, and also allows the readers here to see the aspects already discussed (like the regex and plug-in solutions to validating a single email address, which some of us were actually just discussing in the original thread earlier today).

    harshitb6843
    January 4, 2024

    I can understand that it can somethings feel like your thread is not getting any attention because a lot of new questions have been posted after that and hence you are left with no other option than creating a new thread but what you could instead do is reply to your existing thread so it comes on top again and gain people's attention. See you on the other thread!!