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 Apps
Answered

Input verification

(0) ShareShare
ReportReport
Posted on by 171

I have a formula where a colon is set if there is none. This should then be patched into the dataverse. But now I want to catch errors such as only numbers can be entered and then only permissible hours and minutes. eg 23:59 or 2359 should be the highest possible number.

 

 

If(
 Len(inpOrderTimeMonday.Text) > 2 && !(":" in inpOrderTimeMonday.Text),
 UpdateContext(
 {
 locVarColonCheckGalleryMo: If(
 Len(inpOrderTimeMonday.Text) = 3,
 Left(
 inpOrderTimeMonday.Text,
 1
 ) & ":" & Right(
 inpOrderTimeMonday.Text,
 2
 ),
 Left(
 inpOrderTimeMonday.Text,
 Len(inpOrderTimeMonday.Text) - 2
 ) & ":" & Right(
 inpOrderTimeMonday.Text,
 2
 )
 )
 }
 ),
 UpdateContext({locVarColonCheckGalleryMo: inpOrderTimeMonday.Text})
 ;
 Reset(inpOrderTimeMonday);
);

Patch(
 ServiceCapture,
 Defaults(servicecapture),
 {
 Date: DateValue(lblDateMonday.Text, "en"),
 Hours: cmpDateTimeFunctions_1.FormatHoursAsMinutes(locVarColonCheckGalleryMo),
 Note: inpNoteMonday.Text
 }
);

 

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @alt88 ,

     

    I would offer you a better approach to achieve this goal. Please set below formula OnChange of the Text Input box:

    If(
     IsMatch(
     Self.Text,
     "^(?:\d|[01]\d|2[0-3]):[0-5]\d$",
     MatchOptions.Complete
     ) || IsMatch(
     Self.Text,
     "^(?:\d|[01]\d|2[0-3])[0-5]\d$",
     MatchOptions.Complete
     ),
     If(
     Len(inpOrderTimeMonday.Text) > 2 && !(":" in inpOrderTimeMonday.Text),
     UpdateContext(
     {
     locVarColonCheckGalleryMo: If(
     Len(inpOrderTimeMonday.Text) = 3,
     Left(
     inpOrderTimeMonday.Text,
     1
     ) & ":" & Right(
     inpOrderTimeMonday.Text,
     2
     ),
     Left(
     inpOrderTimeMonday.Text,
     Len(inpOrderTimeMonday.Text) - 2
     ) & ":" & Right(
     inpOrderTimeMonday.Text,
     2
     )
     )
     }
     ),
     UpdateContext({locVarColonCheckGalleryMo: inpOrderTimeMonday.Text});
     Reset(inpOrderTimeMonday);
     ),
     Notify("you must enter a valid time format value");
     Reset(inpOrderTimeMonday)
    )

     

    So users need to type in a valid hh:mm or h:mm time format value otherwise the textinput box will reset and notify an error message.

     

    Best regards,

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard