Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Unanswered

Web Form Field Validation - Limit characters

(0) ShareShare
ReportReport
Posted on by 11

Sorry in advance. I am a complete noob at this.

 

Basically I want to limit the number of words that can be used in a large multiline text field in a Dynamics Portal Webform. I know what you are thinking, but just I can't set a small character limit on the field in Dynamics, because I want to use this field for multiple forms with different character length restrictions, so need to throttle the word count on the portal side through validation (per form tab).

 

I've tried using this REGEX I scraped from a forum ^\W*(?:[\w\.\,]+(?:\W+|$)){1,10}$ but is isn't working. I cant get any REGEX to work in the portal for that matter. I don't know if this is just me or if it just doesn't work. 

 

The other option is to use the Custom JAVA. I'm not a coder, and I cant be the only person on the planet who needs this. And I cant find a repository or forum that I can rob from.

 

The field is called tri_multilinetext1 

It's a required field, and cannot contain more than 10 words.

If it does, prevent the tab proceeding, and display an error message to say. You're an idiot! The question asks for 10 words, you've inputted 11 (Obviously will need a calculation to display the 11, but surely that will be part of the validation anyway?)

 

Can anyone help please?

  • natalya Profile Picture
    133 on at
    Re: Web Form Field Validation - Limit characters

    Hi @jamestredree,

    You can add a validation rule to the form.

    After clicking "Submit" user will get an error message.

    See the link below for client-side validation

    Add custom JavaScript - Power Apps | Microsoft Docs

    For checking the number of words you can also use :

    "

    var strNumWords = $("#field_to_check").val();
    strNumWords= strNumWords.trim();
    strNumWords= strNumWords.split(/\s+/).length;

    "

    Hoping it helps.

     

     

  • jamestredree Profile Picture
    11 on at
    Re: Web Form Field Validation - Limit characters

    Thanks for this. But how do I limit the text in the box to a specific number or characters or words?

  • natalya Profile Picture
    133 on at
    Re: Web Form Field Validation - Limit characters

    Hi

    Try using the following RegEx  /\b\w+\b/g

    Hoping it helps.

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35