cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
mmangiante
Level 8

How to validate time from sharepoint customized form

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

5 REPLIES 5
Super User
Super User

Re: How to validate time from sharepoint customized form

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
Level 8

Re: How to validate time from sharepoint customized form

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.

Super User
Super User

Re: How to validate time from sharepoint customized form

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



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Super User
Super User

Re: How to validate time from sharepoint customized form

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

mmangiante
Level 8

Re: How to validate time from sharepoint customized form

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?

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 103 members 3,884 guests
Recent signins:
Please welcome our newest community members: