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 Apps / Auto (Slash) add in in...
Power Apps
Answered

Auto (Slash) add in input field

(0) ShareShare
ReportReport
Posted on by 58

Hi All,

I have been trying to create a user form. I have a field named "Valid to" were user will be typing date in (mm/dd/yyy) format and I have some other conditions so I cant use Date picker . My query is when user typing date I need to auto populate slash(/) between the mm/dd/yyy is it possible to add slash between intervals so user don't have to add slash manually.

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    What about letting User select a DatePicker and the results or what has been selected Automatically populate the Textbox?

     

    In the Default of the Textbox;

    DatePicker1.SelectedDate

    Format the DatePicker to "mm/dd/yyyy"

     

    If that's not ok try validating the Textbox using the Fill color;

    If(IsMatch( "11/11/1111", "\d{2}-\d{2}-\d{4}" ),White,Red)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Verified answer
    iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    I like where @eka24 is going with the IsMatch Regex, and I think we can extend that to actually insert the slashes when the format matches one of two correct formats.

     

    So keep the Text colour setting @eka24 suggested, this will notify the user when the format they've entered is incorrect, but only if it matches ##-##-####, so we can extend that to include ######## and ##/##/#### as well:

    If(
     IsMatch( Self.Text, "\d{2}-\d{2}-\d{4}" )
     ||
     IsMatch( Self.Text, "\d{2}\d{2}\d{4}"
     ||
     IsMatch( Self.Text, "\d{2}\/\d{2}\/\d{4}" )
     ,White,Red
    )

     

    Then in your control's Default, set it to DateValidated

    (a variable we will shortly set via the OnChange)

     

    in your control's OnChange, have it do the following:

    If(
     IsMatch(Self.Text), "\d{2}-\d{2}-\d{4}",
     Set(DateValidated,
     Left(Self.Text,2) & "/"
     & Mid(Self.Text,4,2) & "/"
     & Mid(Self.Text,7,4)
     ),
     IsMatch(Self.Text), "\d{2}\d{2}\d{4}",
     Set(DateValidated,
     Left(Self.Text,2) & "/"
     & Mid(Self.Text,3,2) & "/"
     & Mid(Self.Text,5,4)
     )
    )

     

    What the above does is adds in the text slashes to either 01032020 or to 01-03-2020 if it matches those patterns 🙂

     

    Hope this helps!

     

    Cheers,

    Sancho

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard