Question T396
Visible to All Users

Validators email won't work under certain conditions

created 7 years ago

Hi everyone,

I couldn't have the email validated with that page conf :

JavaScript
{ name: "email", elements: [ { type: "text", name: "Merci d'indiquer votre email, il servira uniquement pour vous tenir informé(e) des résultats de l'étude.", valueName: "email", isRequired: {{required}}, validators: [ { type: "email", text: "L'email indiqué ne semble pas valide" } ], inputType: "email" } ], visibleIf: "{email}empty" },

I had to change the value name to make work. Probably a confusion with the page name …

JavaScript
{ name: "email", elements: [ { type: "text", name: "Merci d'indiquer votre email, il servira uniquement pour vous tenir informé(e) des résultats de l'étude.", valueName: "email_participant", isRequired: {{required}}, validators: [ { type: "email", text: "L'email indiqué ne semble pas valide" } ], inputType: "email" } ], visibleIf: "{email}empty" },

** valueName: "email_participant",**

Comments (3)

    Hello Eliot,
    Unfortunately, I could you reproduce the issue: https://plnkr.co/edit/Atc970PWEA7OTyuPafFE?p=preview
    Could you please help us to reproduce it, so we will be able to fix it?

    Thank you,
    Andrew
    SurveyJS Team

      Eliot,
      Sorry, we see the problem now.
      Invalid e-mail value stores in the survey.data, as result email is not empty and the page becomes invisible.
      We will make you an example shortly, that will work as expected, by using custom function feature. We will add isEmailValid function that you may use in .

      Thank you,
      Andrew
      SurveyJS Team

      EM EM
      Eliot McAlyster 7 years ago

        You have to add the visibleIf property to the page (called 'email') holding the script.

        Answers

        created 7 years ago

        Thank you guys ! My first survey is live now and it's working perfectly : )

          Comments (1)

            That is great!

            Thank you,
            Andrew
            SurveyJS Team

            created 7 years ago

            Hello Eliot,

            We've prepared an example for you with custom "isValidEmail" function in the visibleIf expression:
            https://plnkr.co/edit/EJONIm?p=preview
            Please check it.

            Thanks, Serge
            SurveyJS Team