I am trying to validate that certain fields contain data before sending the data to my SharePoint list. Right now I am doing something like this...
If( !IsBlank(TxtInput_1.Text, Set(BorderColor, Red), Set(BorderColor, Black)) && !IsBlank(DropDwn_1.Selected.Value.Text, Set(BorderColor, Red), Set(BorderColor, Black)) && !IsBlank(radioBtn_1.Selected.Value, Set(BorderColor, Red), Set(BorderColor, Black)) Patch( MyList_1, Defaults(MyList_1), { } ) )
but this is giving me errors that state that there are some invalid arhuments. What is the best way to go about doing this?
Solved! Go to Solution.
Hi @Spawn10 ,
If you use this formula, whether the field is blank will not effect the patch operation.
It only effect the border color.
Regardless the field is blank or not , the patch function will perform.
Do you want that if any field is blank, the patch operation will not perform?
Best regards,
Community Support Team _ Phoebe Liu
Hi @Spawn10 ,
In the BorderColor property of each control that you wanted to highlight, you would put the following formula
If(!IsBlank(DataCardValue16.Text),Black, Color.Red)
Once you submit the form, it won't matter what the border color is. If you want to prevent the user from submitting the form unless the field has data, then set the Required property of the card containing those particular controls to true. That will change the border properties, prevent the form from being submitted and show an error message.
Hi @Spawn10 ,
Do you want that: if all the fields are not null, the border color is black; if any field are null, the border color is red?
I suggest you try this formula: ( the border color is not related with patch function.)
If( !IsBlank(TxtInput_1.Text)&&!IsBlank(DropDwn_1.Selected.Value.Text)&& !IsBlank(radioBtn_1.Selected.Value),
Set(BorderColor, Black),
Set(BorderColor, Red)
); Patch( MyList_1, Defaults(MyList_1), {....,.....,..... } )
Best regards,
Community Support Team _ Phoebe Liu
thank you for the help v-yutliu-msft.
I just have one question...using it this way, won't the patch operation still be executed even if one of the fields is blank?
Hi @Spawn10 ,
If you use this formula, whether the field is blank will not effect the patch operation.
It only effect the border color.
Regardless the field is blank or not , the patch function will perform.
Do you want that if any field is blank, the patch operation will not perform?
Best regards,
Community Support Team _ Phoebe Liu
Yes I didn't want the patch to perform, if those fields were blank. I ended up using this syntax and it served my purpose....
If( IsBlank(TxtInput_1.Text) || IsBlank(DropDwn_1.Selected.Value.Text) || IsBlank(radioBtn_1.Selected.Value), Set(BorderColor, Red), Patch( MyList_1, Defaults(MyList_1), {....,.....,..... } ) );
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
199 | |
71 | |
49 | |
41 | |
30 |
User | Count |
---|---|
266 | |
121 | |
94 | |
90 | |
81 |