Examples of Control validations in PowerApps
Many times we have situations where we need to validate various controls on any form. Doing this on PowerApps forms is tricky (being a techie, your default psyche would be to write one line of code to achieve this -- however as you know, that is not the case with the PowerApps: courtesy its low code, no code philosophy 💔💔💔).
To check if a control is empty:
The following form contains an EmplId field, which is a mandatory field. We can add a label file like this:
Go to the label file's Visible event:
And write on the following formula:
And then in the visible event of the label control, you write:
As a result, when you run the form, as a preview:
Giving something gibberish will give you an error like this. However, giving a proper email Id, this label disappears:
Date control validations:
Similarly, we can embed a datepicker control and ensure that the user doesn't select a future date, simply by writing:
When an employee's age is above 50, then suppose the organization makes him to invest in NPS. The following arrangement can help you with that:
The slider control allows the user to choose any value between 25 to 60. The below label and controls can be made to be given a visible event that says:
Pen input controls are an amazing feature of PowerApps, that can help the user to validate and store their signatures. Go ahead with selecting a 'Pen input' control from the 'Insert' drop-down list:
Pen controls can be used just not to capture the signature, but also
a. You can reset/remove whatever you have drawn
b. You can change the color of the pen while signing.
c. You can erase the drawing if needed.
Now, go to the signature control, select Advanced >> OnSelect event:
Here I am storing the value of the image in a local variable called: ImageContent >>On your submit button >> DisplayMode event, write the following:
Consequently, as long as you are not writing any signature, the submit button won't be enabled at all:
Stay tuned.👋👋👋
Comments
Post a Comment