cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jo_25
Helper I
Helper I

How to validate if user have click compute button to recompute leave duration before computing form.

I have a button to allow users to compute leave duration after they selected start and end date of leave. If they did not click the button, leave duration will not be computed or recomputed after they selected or change start and end date of leave. 

How do I check if the users have click compute button before allowing them to submit form. 

 

Please help!! Any tips, guidance much appreciated. 

 

Jo

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Jo_25 ,

There are a couple of possibilities, but I would go with a Variable.

At Screen OnVisible

UpdateContext({varCalc:false})

On the OnSelect of the Compute Button

UpdateContext({varCalc:true})

On the DisplayMode of the Submit form button

If(
   varCalc,
   DisplayMode.Edit,
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @Jo_25 ,

There are a couple of possibilities, but I would go with a Variable.

At Screen OnVisible

UpdateContext({varCalc:false})

On the OnSelect of the Compute Button

UpdateContext({varCalc:true})

On the DisplayMode of the Submit form button

If(
   varCalc,
   DisplayMode.Edit,
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Many thanks Warren. The solution is working very well. 

Now, the users will not be able to submit the form when they did not click the compute button. All thanks to your help!! 😀

 

I have another issue with the compute button  - not related to the solution you offered. 

The compute button is able to compute the no of leave requested and stored it in a global variable - _requestedDays. However, the Duration field (which is a number field in Sharepoint) is not being updated with the _requestedDays when I do a SubmitForm to create the new record in Sharepoint. 

I read from some forum post that I need to set the Default property of the Duration card to 

If(!IsBlank(_requestedDays), _requestedDays, ThisItem.Duration) but somehow Duration field in Sharepoint is not updating.  See screen capture below. How can the Duration field be updated? Please help. 

 

sc5.PNGsc4.PNG

Hi @Jo_25 ,

I have answered you over on the new post you did.

I suspect I am in a different time zone to you  (I am at UTC + 10 - Eastern Australia)

Jo_25
Helper I
Helper I

Hi, Warren

 

Thanks. I posted in the new post cos I am seriously desperate to get solution to the issue. I have been searching forum posts and tried what suggested but with no success.  

 

Jo

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (3,925)