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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / validate field value w...
Power Pages
Unanswered

validate field value with RegEx on field focusOut

(0) ShareShare
ReportReport
Posted on by 37

Hi Community,

 

I have scenario in PowerApps portals where I need your help.

 

while creating a record through Basic form(earlier Entity form), I want to verify field value once user moves out of field (before user clicks submit button). Any idea how can I do this?

 

I wrote code as below, but it's not working:

$("#nt_pannumber").focusout(function () {
    //$(this).css("background-color", "#FFFFFF");

    // Regular expression with Indian PAN format
    var regExp = /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
    var panValue = $("#nt_pannumber").val();
    alert(panValue);
    if (panValue.search(regExp) == -1) {
        alert("Invalid PAN number format");
    }
});

 

Please suggest me how to do this.

 

Thanks!

Hardik

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

    Hi @chauhanhardik ,

     

    To achieve this functionality I would do the following:

    1. add validation on blur

    '$("#your_filed").blur(function(){

    var regExp = /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
    var isInvalid = !regExp.test(inputValue);
    }'

    2. add validation on submit as well

    Add custom JavaScript - Power Apps | Microsoft Docs

     

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 47 Super User 2026 Season 1

#2
sannavajjala87 Profile Picture

sannavajjala87 14 Super User 2026 Season 2

#3
SP2019admin Profile Picture

SP2019admin 12

Last 30 days Overall leaderboard