web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Web Form Field Validat...
Power Pages
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?

Categories:
I have the same question (0)
  • natalya Profile Picture
    133 on at

    Hi

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

    Hoping it helps.

     

  • jamestredree Profile Picture
    11 on at

    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

    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.

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard