cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User
Super User

Re: How do you determine if Pen Input is blank?

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",ContentBytesSmiley TongueenInput1.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

25 REPLIES 25
Super User
Super User

Re: How do you determine if Pen Input is blank?

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
)
Super User
Super User

Re: How do you determine if Pen Input is blank?

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
Super User
Super User

Re: How do you determine if Pen Input is blank?

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",ContentBytesSmiley TongueenInput1.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

Super User
Super User

Re: How do you determine if Pen Input is blank?

Sorry to keep replying to myself. Smiley Happy 

 

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
patrickabel
Level: Powered On

Re: How do you determine if Pen Input is blank?

@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.

 

 

Super User
Super User

Re: How do you determine if Pen Input is blank?

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?

patrickabel
Level: Powered On

Re: How do you determine if Pen Input is blank?

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.

Super User
Super User

Re: How do you determine if Pen Input is blank?

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

 

 

jc_ec
Level: Powered On

Re: How do you determine if Pen Input is blank?

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
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: 139 members 3,084 guests
Please welcome our newest community members: