cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

How do you make a field required in the form?

I have a field that needs to be "required ". If the user submits a form without having any input in that field, the form shouldnt submit. 

 

I made the card "required" value to "TRUE" but it doesnt work.

 

Can someone help me with this?

 

Thanks!!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How do you make a field required in the form?

Hi @asdeev,

How do you submit your form data? Using SubmitForm function or Patch function?

If you use the SubmitForm function to submit your form data, please consider take a try with the following workaround:9.JPG

Set the Required property of the Data card property (related to the field you want to mark as Required) to following:

true        /* <-- A boolean value */

then the Data card would be marked as Required with * sympol. When you submit your form without having value in that field, the error message would show up:10.JPG

 

If you use a Patch function to submit your form data, I think the If function could achieve your needs. You could consider check if the corresponding field within your Edit form is populated with values using If function. If not, don't patch your form data into your data source.

I have made a test on my side, please take a try with the following workaround:11.JPG

Set the OnSelect property of the "Submit" button to following:

 

If(
    IsBlank(DataCardValue9.Text),
    Notify("The Required field could not be blank, please provide a value for it", NotificationType.Error),
    Patch('20181122_case14', Defaults('20181122_case14'),EditForm1.Updates)
)

On your side, you should type:

 

If(
IsBlank(DataCardValue9.Text), /* <-- DataCardValue9 represents the Text Input box within the corresponding field Data card */
Notify("The Required field could not be blank, please provide a value for it", NotificationType.Error),
If(
EditForm1.Mode=FormMode.New,
Patch('YourSPList', Defaults('YourSPList'),EditForm1.Updates),
Patch('YourSPList', BrowseGallery1.Selected,EditForm1.Updates)
)
)

In addition, when using SubmitForm function to submit your form data, you could also consider use If function to check if the corresponding field within your Edit form is populated with values, if not, don't submit your form data:

If(
    IsBlank(DataCardValue9.Text), /* <-- DataCardValue9 represents the Text Input box within the corresponding field Data card */ 
    Notify("The Required field could not be blank, please provide a value for it", NotificationType.Error),
    SubmitForm(EditForm1)
)

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Community Support
Community Support

Re: How do you make a field required in the form?

Hi @asdeev,

How do you submit your form data? Using SubmitForm function or Patch function?

If you use the SubmitForm function to submit your form data, please consider take a try with the following workaround:9.JPG

Set the Required property of the Data card property (related to the field you want to mark as Required) to following:

true        /* <-- A boolean value */

then the Data card would be marked as Required with * sympol. When you submit your form without having value in that field, the error message would show up:10.JPG

 

If you use a Patch function to submit your form data, I think the If function could achieve your needs. You could consider check if the corresponding field within your Edit form is populated with values using If function. If not, don't patch your form data into your data source.

I have made a test on my side, please take a try with the following workaround:11.JPG

Set the OnSelect property of the "Submit" button to following:

 

If(
    IsBlank(DataCardValue9.Text),
    Notify("The Required field could not be blank, please provide a value for it", NotificationType.Error),
    Patch('20181122_case14', Defaults('20181122_case14'),EditForm1.Updates)
)

On your side, you should type:

 

If(
IsBlank(DataCardValue9.Text), /* <-- DataCardValue9 represents the Text Input box within the corresponding field Data card */
Notify("The Required field could not be blank, please provide a value for it", NotificationType.Error),
If(
EditForm1.Mode=FormMode.New,
Patch('YourSPList', Defaults('YourSPList'),EditForm1.Updates),
Patch('YourSPList', BrowseGallery1.Selected,EditForm1.Updates)
)
)

In addition, when using SubmitForm function to submit your form data, you could also consider use If function to check if the corresponding field within your Edit form is populated with values, if not, don't submit your form data:

If(
    IsBlank(DataCardValue9.Text), /* <-- DataCardValue9 represents the Text Input box within the corresponding field Data card */ 
    Notify("The Required field could not be blank, please provide a value for it", NotificationType.Error),
    SubmitForm(EditForm1)
)

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper V
Helper V

Re: How do you make a field required in the form?

Thanks a ton! Kris. It works for me and I am using patch function.

Highlighted
Helper III
Helper III

Re: How do you make a field required in the form?

Is there any change in Powerapps about this "required" option? 

I tried your steps - but it only puts the asterisk on the field where I set "yes" to "required"  - but the form still submits and I can still see the record in SP list.

 

 

Thank You and Kind Regards,

Kh

Highlighted
Super User
Super User

Re: How do you make a field required in the form?

Are you using SubmitForm or Patch to submit your form?

Thanks,
Hardit Bhatia
https://thepoweraddict.com
Highlighted
Helper III
Helper III

Re: How do you make a field required in the form?

Hello, 

 

I'm not sure if you are referring to my question - because there's another person ahead of me.  Sorry.

But if it's for me, Thank You. I am using a SubmitForm. 

 

Kind Regards,

KH

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,201)