cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

How do you determine if Pen Input is blank?

I want to have a pen input to collect a signature and I only want to show the user the submit button after they have signed the form. 

 

How do I check if they have scribbled something in the box or not?

 

Thanks

 


Shane

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

I did some messing around and the best workaround I have come up with is to see if the image URL has changed. Hopefully, someone has something better. Here is what I did:

 

1. Set the Screen OnVisible property to: 

UpdateContext({BlankImage: Signature.Image})

2. Set the DisplayMode of my consent button to 

If(BlankImage = Signature.Image,DisplayMode.Disabled,DisplayMode.Edit)

3. Set the OnSelect of my consent button to 

Office365.SendEmail("shane.young@boldzebras.com","My Consent Form" , "Body Text",{Attachments:Table({Name:"peninput.jpg",ContentBytes:PenInput1.Image , '@odata.type':""})});UpdateContext({BlankImage: Signature.Image})

I reset the variable to disable the button again so I can collect a new sig. Will add code to clear the other fields also.

 

If you didn't catch it earlier Signature is what I renamed my PenInput field to.

 

If anyone has a better solution I am all ears. I don't love this but I think it works.

 

Thanks

 


Shane

 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

28 REPLIES 28
Highlighted
Super User III
Super User III

Hi Shane

 

Here's a formula you can use:

 

IsBlank(PenInput1.Strokes)

This will return false when a user scribbles something in the box.

 

To carry out this task, you can set the DisplayMode property of your submit button to this:

 

If(IsBlank(PenInput1.Strokes), 
   DisplayMode.Disabled, 
   DisplayMode.Edit
)
Highlighted

Hi TimL

 

I tried that and it doesn't work. Best I can tell there is no value stored in .Strokes Smiley Indifferent

 

I tried adding the code to the button and it stays disabled.

 

I also added a Label and set the text to Signature.Strokes and nothing shows. (I named my pen input Signature and it autocompletes without issue.)

 

Finally tested the app on my phone just to make sure my computer wasn't being dumb. No dice.

 

Thanks for any thoughts

 

Shane

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Highlighted

I did some messing around and the best workaround I have come up with is to see if the image URL has changed. Hopefully, someone has something better. Here is what I did:

 

1. Set the Screen OnVisible property to: 

UpdateContext({BlankImage: Signature.Image})

2. Set the DisplayMode of my consent button to 

If(BlankImage = Signature.Image,DisplayMode.Disabled,DisplayMode.Edit)

3. Set the OnSelect of my consent button to 

Office365.SendEmail("shane.young@boldzebras.com","My Consent Form" , "Body Text",{Attachments:Table({Name:"peninput.jpg",ContentBytes:PenInput1.Image , '@odata.type':""})});UpdateContext({BlankImage: Signature.Image})

I reset the variable to disable the button again so I can collect a new sig. Will add code to clear the other fields also.

 

If you didn't catch it earlier Signature is what I renamed my PenInput field to.

 

If anyone has a better solution I am all ears. I don't love this but I think it works.

 

Thanks

 


Shane

 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

Highlighted

Sorry to keep replying to myself. 🙂 

 

I made this into a video. Conditional Formatting with the Pen Input

 

I hope it helps.

 

 

Shane

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Highlighted

@Shanescows any luck finding a less cumbersome solution?

 

The absense of a value on .Strokes has got to be a bug. **bleep**'s unfortuante that the simplest of validation isn't doable without image comparisons at this point.

 

 

Highlighted

Hi all,

 

I'm a bit confused. For me, .Strokes returns a value when I scribble into the control. When the pen input control is empty, .Strokes returns blank.

 

dotstrokes.JPG

 

Is there something that I'm misunderstanding here, or is my version of PowerApps behaving differently to everyone else?

Highlighted

I can do another test to confirm, but this did not work for me after incorporating into a rule which shows/hides a button.

IsBlank(PenInput1.Strokes)

 I ended up leveraging an image compare as @Shanescows recommended.

Highlighted

Hi @patrickabel

 

Thanks for the clarification. It's curious because I can use .Strokes as I'd expect to in a rule. Here for example, I'm able to show the button only when the pen input control contains data.

 

 Pinput1.PNG

 

 

Highlighted
Anonymous
Not applicable

Hi Shane,

 

Thank you for your solution, the YouTube video was very helpful also.

How would you ammend the string so that it looks at two signature fields?

(Assuming Signature1 and Signature2)

 

Thank you

 

Kind regards

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,697)