What is "parent.error" in regards to form validation?
The default error message that is auto-generated when creating a PowerApp from a Sharepoint form has its Text property set to parent.error.
Unfortunately, the parent (Data Card?) has no "error" property
And neither does the Form:
Where is the mysterious .error property? I'm also interested in ErrorKind. I see the docs on them but cant seem to find them inside my app anywhere.
Hi!
In the PowerApps documentation there is a line regarding .Error:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-cards
The Valid property is driven from the metadata of the data source, based on the DataField property. It's also based on the Required property and whether the Update property contains a value. If the value on the Update property isn't valid, the Error property provides a user-friendly error message.
You are correct that the parent is a DataCard control. The DataCard itself does not list the Error property because it is an output only property of the DataCard. It can be read by another rule but it cannot be set.
Thanks for the response @LukeW-MSFT. Here's my problem: I deleted the auto-generated asterisk and error message (basically negating all the aweseome built in error handling, rookie mistake) and now I need to manually rebuild it.
Unfortunately, when functions like Error are "hidden", I'm having trouble reverse engineering them. Any further insights on how to recreate the built-in form error handling OnSubmit?
I read the docs but they don't quite reveal what I need.
Hey again,
The way I see it you have a few options for rebuilding the data card and it's sub-controls (including the asterisk and error message):
1. Undo your changes back to before the delete.
2. Go back to an older version of your app, if you happened to save/publish before you deleted.
3. Create a new form based on your dataset if its not too much trouble, the new form will have all the defaults set like before.
I don't think it is possible to delete labels that are parented by a data card. So you must have deleted the entire card, right? If that is true, then another option is to: Select the form > In the properties tab on the right, select the data souce linked in the "Data" row > In the flyout pane select under "Fields" select the field you wish to bring back.
Hope one of these options works for you! If not, let me know.
Directly after creating the app from a Sharepoint list (months ago) I deleted the Error Message and Star from each data card. The reason I deleted the controls is because once I renamed another Data Card element (label or dropdown I think), these two controls threw "!" errors due to the change naming.
At the time I was new to PA and didn't think twice about deleting them ("Aha! Took care of those pesky " ! " 's). Now I'm feeling the pain here. Unfortunately, I can't go back to a previous version of the app to recover them nor can I delete the custom cards I've created and pull them in again (WAAAAAYYYY to much customization at this point).
Hm. Looks like I'll end up controlling the Visibility of the red asterisk and the DisplayMode of the Submit Button based on the Dropdown/Text box values as there isn't a way to rebuild the native error handling once these controls are deleted.
From the docs: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail#key-proper...
Valid – Whether a Card or Edit form control contains valid entries, ready to be submitted to the data source.
To enable a button to save changes only when the data in a form is valid but hasn't yet been submitted, set the button's Enabled to this formula:
SubmitButton.Enabled = IsBlank( Form.Error ) || Form.Valid
Looks like Form.Error and Form.Valid Properties are not exposed in PowerApps. This is blocking me from rebuilding the error handling. Do you know how to get this functionality back?
Not sure I understand fully. You should be able to read output properties like Form.Error or Form.Valid as I exemplify below. Can you screenshot the error message you get when you try to use these properties?
I'm having trouble figuring out exactly what is going on. This is probably TLDR, but if you have the stomach to continue assisting, here it is 🙂
Dropdown Items has a blank option. I've also tried Blank() as an option, no go.
Error Message set to Parent.Error
Red Asterisk: If Parent.Required is true and the dropdown is blank, show the asterisk.
//Doesn't work either: If( IsBlank(dropdown_input.Selected.Value), true, false)
Card (parent) is set to Required True and you can see the dropdown is blank BUT no red asterisk...
AND.. when executing SubmitForm() the error message doesn't show up.
Pecurliar because the Data Cards above are setup similar (Textboxes instead of Dropdown) and they work fine:
Thanks for the detailed screenshots/info. Helps me understand. First, something simple, have you tried this for the asterisk visible:
If( dropdown_input.Selected.Value = " ", true, false)
Nice! There IS a difference between blank and " ". Wow.
Ok. So I got the asterisk to show now with the Visible formula set to:
If( dropdown.seleced = " ", true, false)
Now... Why when I click Submit, which executes SubmitForm(formname), does the form not error out?
There are 14 cards set to Required, yet the form submits with blank values.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
218 | |
207 | |
85 | |
57 | |
36 |