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 Apps / How to validate time f...
Power Apps
Unanswered

How to validate time from sharepoint customized form

(0) ShareShare
ReportReport
Posted on by 304

Hello,

 

I created a list on SharePoint Online and clicked on customize it in PowerApps: the list has 2 date/time columns with date and hour showed; in PowerApps these are represented with datepicker for date and dropdowns for hour and minutes; I'd like to set some validation rules on hours but I can't understand where to do it; my first question is: when in SharePoint I click in Save, what PowerApps action is raised in the "SharePointIntegration" control? I supposed it is "OnSave" so I tried to do some test on it but without luck.

What I like to have is some rules when the user choose an hour value and if it is, for example, greater than another value, I can't save the form.

It is simplistic as explanation but I don't find where to start and where are the action or properties that I can modify.

 

Marco

Categories:
I have the same question (0)
  • aprildunnam Profile Picture
    704 on at

    If you're end goal is not letting the user submit the form based on a condition then you would do that on the OnSave property.  What formula were you using in your OnSave function?  Did you get an error and if so what error did you get?

  • mmangiante Profile Picture
    304 on at

    Hi @aprildunnam

     

    to do a test I tried this: my field was called "HourValue1" when I created the integration in SPO, so I tried something similar to 

     

    If((HourValue1.value) > 9; "There is an error"; SubmitForm(SharePointForm1))

    but when I write this I have a green color around the HoudValue1 and the message say that argument type is not valid and that a number is expected; I also tried HourValue1.Selected but it doesn't work: I suppose that an if inside that declaration is not valid.

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    Is HourValue1 the name of the control on the screen and if so, what kind of control is it?

  • aprildunnam Profile Picture
    704 on at

    Just to confirm, HourValue is a Number Field Type in your SharePoint list correct?

  • mmangiante Profile Picture
    304 on at

    Hello @aprildunnam and @Jeff_Thorpe

     

    HourValue1 in PowerApps is a dropdown box; in SharePoint, I have a date/time column and the format include Date and Hour (like in the image, sorry the language you see is italian):

    SharePoint_field_DateHour.png

     

    When I personalized the new form in SharePoint, PowerApps created the form page and set a datepicker for date and 2 dropdown boxes, one for hour and the other for the minutes (as in the images for date and hour):

     

    PowerAppsHour.pngPowerAppsDate.png

     

    Now, I even tried tried with the formula:

     

    If((Value(HourValue1.Selected.Value)) > 9; "There is an error"; SubmitForm(SharePointForm1))

    on the OnSave action and it seems that it is accepted without any error, but when I fill the fields in SharePoint it save it like there is no control on this if; maybe I can create a label inside the form and set the visible property to true when the result of the if statement is True but how to block the save?

     

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard