Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Need a validation message for Email field after tab out in portal page

Posted on by 465

Hi All,

I am using Power Apps portals

I need a validation for email field when I tab out the field in portal page.

How can I implement this

Regards,

Babu

  • Narendra Sunkara Profile Picture
    Narendra Sunkara 465 on at
    RE: Need a validation message for Email field after tab out in portal page

    Hi Thanks for your reply.

    I could able to fix this issue in other way.

    Added "Regular expression" in Entity form meta data in my entity form. Now my attachment is not clearing even though my email address is invalid.

    Here is the screen shot.

    3441.pastedimage1588897213804v1.png

    Regards,

    Babu

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need a validation message for Email field after tab out in portal page

    The first part of the form is the form tag:

    <form name="contact_form" method="post"

    action="/cgi-bin/articles/development/

     javascript/form-validation-with-javascript/contact_simple.cgi"

    onsubmit="return validate_form ( );">

    The form is given a name of "contact_form". This is so that we can reference the form by name from our JavaScript validation function.

    The form uses the post method to send the data off to a dummy CGI script on ELATED.com’s server that thanks the user. In reality, you would of course send the data to your own CGI script, ASP page, etc. (e.g. a form mailer).

    Finally, the form tag includes an onsubmit attribute to call our JavaScript validation function, validate_form(), when the “Send Details” button is pressed. The return allows us to return the value true or false from our function to the browser, where true means “carry on and send the form to the server”, and false means “don’t send the form”. This means that we can prevent the form from being sent if the user hasn’t filled it in properly.

    The rest of the form prompts the user to enter their name into a form field called contact_name, and adds a “Send Details” submit button:

    <h1>Please Enter Your Name</h1>

    <p>Your Name: <input type="text" name="contact_name"></p>

    <p><input type="submit" name="send" value="Send Details"></p>

    </form>

    Now let’s take a look at the JavaScript form validation function that does the actual work of checking our form.

    The validate_form() function

    The form validation function, validate_form(), is embedded in the head element near the top of the page:

    <script type="text/javascript">

    <!--

    function validate_form ( )

    {

       valid = true;

       if ( document.contact_form.contact_name.value == "" )

       {

           alert ( "Please fill in the 'Your Name' box." );

           valid = false;

       }

       return valid;

    }

    //-->

    </script>

    The first line (<script type="text/javascript">) tells the browser that we are writing some JavaScript, and the HTML comment (<!--) in the second line hides the script from older browsers that don’t understand JavaScript.

    Next we start our validate_form() function, then set a variable called valid to the value true:

    function validate_form ( )

    {

       valid = true;

    We use this valid variable to keep track of whether our form has been filled out correctly. If one of our checks fails, we’ll set valid to false so that the form won’t be sent.

    The next 5 lines check the value of our contact_name field to make sure it has been filled in:

       if ( document.contact_form.contact_name.value == "" )

       {

           alert ( "Please fill in the 'Your Name' box." );

           valid = false;

       }

    If the field is empty, the user is warned with an alert box, and the variable valid is set to false.

    Next, we return the value of our valid variable to the onSubmit event handler (described above). If the value is true then the form will be sent to the server; if it’s false then the form will not be sent:

       return valid;

    Finally, we finish our validate_form() function with a closing brace, and end our HTML comment and script element:

    }

    //-->

    </script>

  • Suggested answer
    oliver.rodrigues Profile Picture
    oliver.rodrigues 4,052 on at
    RE: Need a validation message for Email field after tab out in portal page

    What have you tried so far?

    I would add a JS for the onchange event and validate the e-mail: www.edureka.co/.../

    you can also add a mask to your e-mail field: oliverrodrigues365.com/.../

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans