web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to detect if the p...
Power Apps
Answered

How to detect if the penInput is blank or empty

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, 

 

I want to have a pen input to collect a signature, check if the penInput is empty or blank and doing some flows actions. I try this https://powerusers.microsoft.com/t5/General-Discussion/How-do-you-determine-if-Pen-Input-is-blank/td-p/84079 from @Shanescows on a form called when you are on a list SharePoint and it's working great! But when i create my application and want to use it, it's not really work. 

 

To understand why i have this problem, i create two inputs to check my values :

- TextInput2 → On the default data, i set my var BlankImage (created on my EditScreen1 on parameter "OnVisible" with

UpdateContext({BlankImage : MyDoodles.Image})

)

 

- TextInput4 → On default data, i set the value MyDoodles.Image.

 

When I run my application, you can see two blobmanager URLs, where blue line is for my TextInput4  and the other for TextInput2 (my PenInput is empty, I haven't written anything on but i have 2 different URLs).

image.png

 

I don't want to let my user use or click on any button, his job is to sign my form, write some information in and valid his form. After my function check if the penInput is empty or not and doing some actions  in terms of the response.

 

Thanks for your help.

 

Categories:
I have the same question (0)
  • h-nagao Profile Picture
    392 on at

    Hi,

    To compair "blank" image and filled image, I have used JSON(PenInput.Image, IncludeBinaryData).

    JSON(PenInput.Image, IncludeBinaryData) produces data uri of image and compair default data uri and current one, I could detect PenInput is empty.

    *Timer control is monitoring pen input image.

    detect_peninput.png

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you want to detect if the Pen Input control is empty?

     

    Currently, within PowerApps, there is no direct way to detect if a Pen Input control is empty. Even though, you do not draw anything within the Pen Input control (The Pen Input control is Blank), the result the PenInput1.Image formula would still return a blob data (e.g. appres://blobmanager/b8c2a7250f344b148a9a0dfd19e7a6a0/3) rather than empty.

     

    Within the solution mentioned by  @Shanescows, it store the PenInput1.Image result into a variable as Blank Pen Input when you load your Pen Input screen first time. If you draw anything within the Pen Input control, the result the PenInput1.Image formula returned would be different from the variable value you set up before.

    So you could compare the current PenInput1.Image result with the stored variable, to detect if the Pen Input control is "Blank" (You do not draw anything within the Pen Input control).

     

    Please consider set the OnVisible property of the screen which contains the Pen Input control to following:

    Reset(PenInput1);
    UpdateContext({BlankBlobData: PenInput1.Image})

    If you want to detect if the Pen Input control is "Blank" (you do not draw anything within the Pen Input control), please use the following formula:

    If(
     PenInput1.Image = BlankBlobData,
     "Pen Input control is Blank. You do not draw anything within it",
     "Pen Input control is not Blank. You have drawn something within it"
    )

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi thanks for your help,

     

    I test each of your propositions and not really work as I want 😞

     

    @v-xida-msft, I tested to put my Reset(penInput1) on my screen (EditScreen) after my UpdateContext (just to check and understand how this is work). 

     

    When I do this, and I click on my button to have access to my EditScreen, my blob data change 2 times (My UpdateContext return this : appres://blobmanager/b8c2a7250f344b148a9a0dfd19e7a6a0/3 and my penInput1.Image  return this : appres://blobmanager/b8c2a7250f344b148a9a0dfd19e7a6a0/5).

     

    So, I think the reset method change the value of your penInput1 (you can see the value input change when you click on the clean/reset button when your showControls is true).

     

    I remove all my Reset(penInput1) except the one on the onVisible parameter, but the problem has not gone.

     

     

  • Verified answer
    h-nagao Profile Picture
    392 on at
    How about JSON approach?

    I have tested on my side, and it’s working fine.

    For OnVisible property:
    Reset(PenInput1);
    UpdateContext({BlankBlobData: JSON(PenInput1.Image, IncludeBinaryData)})

    and some label text:
    If(
    JSON(PenInput1.Image,IncludeBinaryData) = BlankBlobData,
    "Pen Input control is Blank. You do not draw anything within it",
    "Pen Input control is not Blank. You have drawn something within...”)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi, I was testing with JSON method, modify where I call it (on my iconButton, onSelect), and now, working perfectly.

     

    Thanks for your help.

     

     

  • newbie101 Profile Picture
    44 on at

    Thanks for the solutions above. Here is a simpler solution. 

     

    1. For App, onStart = Set(varBlank, true)
    2. For PenInput1 control,
      1. ShowControls = false
      2. onSelect =  Set(varBlank, false)
    3. Add a button on top of PenInput1 control, onSelect = Reset(PenInput1); Set(varBlank, true)

     

     

     

  • Hor Profile Picture
    38 on at

    The formula 

    If(
    JSON(PenInput1.Image,IncludeBinaryData) = BlankBlobData,
    "Pen Input control is Blank. You do not draw anything within it",
    "Pen Input control is not Blank. You have drawn something within...”)

     

    shows error "behavior function in a non-behavior property. you cant use this property to change values elsewhere in the app.". Could you help please?

  • h-nagao Profile Picture
    392 on at

    Hi Hor,

     

    It is not able to compare JSON() result directly with others.

    Before If operation, Set to some variable, i.e., Set(xxxx, JSON(PenInput1.Image,IncludeBinaryData));

     

    Then If(IsBlank(xxxx),.....) , it allows to detect Blank Input or not.

  • Hor Profile Picture
    38 on at

    Hi

     

    Sorry Im confused, where should I set the variable? I couldnt set the variable at the text label.

     

    On the other hand, does this method also detect if the PenInput control is empty after the "X" button is clicked?

  • DragonLord Profile Picture
    200 on at

    this simply does not work. 

    message is still shows error "behavior function in a non-behavior property. you cant use this property to change values elsewhere in the app."

     

    is this a bug?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard