cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
gazzo1967
Level 8

Stuck with form required issue

Hi All

Totally new to Power apps but really enjoying the learning curve Smiley Happy

I have created a small basic app i have created that inserts into a sharepoint list.

I have created the form and all works wellSmiley Happy

i have a 'fake' submit button which i have directed to a new 'confirmation' screen, this has the actual submit button on it, 

formula used Navigate(Confirm,ScreenTransition.Fade)

when the form has unfilled 'required fields' it allows the form to be submitted when using the actual submit button on the confirmation screen.

 

i have read some post on here but being new it's confusing! usinf IFBLANK or onSuccess (which i can't find)

 

Help would be much appreciatedMan Happy

 

Gary

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Stuck with form required issue

Hi Gary,

In the case of dropdowns, you would need to refer to the actual control name.

To give an example, here's a form that includes a 'choices' field. The name of the control is DataCardValue9.

 

image.png

 

So the formula you would use in this example would be:

If(IsBlank(DataCardValue9.Selected.Value) ,
   Notify("Please enter all required fields", NotificationType.Error),
   Navigate(BA1Confirm,ScreenTransition.Fade)
)

To redirect to another screen, you can Navigate to your new screen after the Notify. You would need to terminate the Notify function with a semi-colon.

If(IsBlank(DataCardValue9.Selected.Value) ,
   Notify("Please enter all required fields", NotificationType.Error);
Navigate(BA1ErrorScreen,ScreenTransition.Fade), Navigate(BA1Confirm,ScreenTransition.Fade) )

 

 

 

View solution in original post

9 REPLIES 9
Super User
Super User

Re: Stuck with form required issue

Hi Gary,

Welcome to PowerApps, glad you're enjoying the learning curve!

A simple way to enforce required fields is to set the required property of the form card to true.  You'll need to click the 'unlock' button first to modify this property.

 

image.png

OnSuccess is property of the form. You'll need to select your form first (eg EditForm1), and the OnSuccess property will then become visible in the Advanced section of the properties pane. Note that the OnSuccess formula runs after form submission, so we would rarely use this for validation purposes.

gazzo1967
Level 8

Re: Stuck with form required issue

Hi @timl

 

Tim thanks for the reply Man Happy

This is set for all my fields its actually the way i havethe navigation set up.

  • User fills form
  • then selects 'Submit' which navigates to a new screen to confirm submit is what the user wants (has other prompts too) if no then a return to form action or a onSelect Submit form action.

my issue is that if a field is missed on the form the user can still navigate away from the form to the confirmation page and submit the form..

 

Sorry i dont think i'm explaining very well

 

Gary

Super User
Super User

Re: Stuck with form required issue

Hi Gary,

I understand what you mean now 🙂

Let's say there's a text input input control on your form that you want to make mandatory.  On a default form, the text input boxes will be named something like DatacardValue9. In the OnSelect property of the button that opens the confirmation screen, enter the following code:

 

If(IsBlank(DatacardValue9.Text),
Notify("Please enter all required fields", NotificationType.Error),
Navigate(Confirm,ScreenTransition.Fade)
)

The If statement here will navigate to the Confirm screen only if DatacardValue9 is not blank.

If there are multiple controls that you want to validate, you can include them with the 'Or' operator (||).

 

If(IsBlank(DatacardValue9.Text) || IsBlank(DatacardValue10.Text) ,
Notify("Please enter all required fields", NotificationType.Error),
Navigate(Confirm,ScreenTransition.Fade)
)

 

gazzo1967
Level 8

Re: Stuck with form required issue

Hi 

i have a mixture of People/Group dropdowns and Choice dropdowns

How do i reference each in the ISBlank Statement?

 

 

Will this work if the DataCardValue is a People/Group column- dropdown?

 

Choices('BA1 Hot wear'.'Assessor Name' is a People/Group field-column

Choices('BA1 Hot wear'.Command) is a Choicesfield-column

 

for example:

If(IsBlank(Choices('BA1 Hot wear'.'Assessor Name')) ,
Notify("Please enter all required fields", NotificationType.Error),
Navigate(BA1Confirm,ScreenTransition.Fade)
)

 

 

When i run this, it is still navigating to the confirmation screen.

i get no errors in the App Checker

also can the notify function redirect navigation to an error screen?

 

I really appreciate your help on thisMan Happy

Gary

Super User
Super User

Re: Stuck with form required issue

Hi Gary,

In the case of dropdowns, you would need to refer to the actual control name.

To give an example, here's a form that includes a 'choices' field. The name of the control is DataCardValue9.

 

image.png

 

So the formula you would use in this example would be:

If(IsBlank(DataCardValue9.Selected.Value) ,
   Notify("Please enter all required fields", NotificationType.Error),
   Navigate(BA1Confirm,ScreenTransition.Fade)
)

To redirect to another screen, you can Navigate to your new screen after the Notify. You would need to terminate the Notify function with a semi-colon.

If(IsBlank(DataCardValue9.Selected.Value) ,
   Notify("Please enter all required fields", NotificationType.Error);
Navigate(BA1ErrorScreen,ScreenTransition.Fade), Navigate(BA1Confirm,ScreenTransition.Fade) )

 

 

 

View solution in original post

gazzo1967
Level 8

Re: Stuck with form required issue

Hi @timl 

It worked Man Very Happy

Thank you for taking the time to support me.

I'm new to this and finding it very interesting and challenging

Thank You again for your support 

Gary

Super User
Super User

Re: Stuck with form required issue

You're welcome Gary, glad to be of help.

gazzo1967
Level 8

Re: Stuck with form required issue

Hi @timl 

Just wanted to expand on this if you wouldn't mind

My logic after reading would suggest that if i have multiple required fields i could write my formula as such:

 

If(IsBlank(rollnumber.Text),
IsBlank(assessorname.Selected.DisplayName),
IsBlank(candname.Selected.DisplayName),
Notify("Please enter all required fields", NotificationType.Error);
Navigate(failed,ScreenTransition.Fade),
Navigate(BA1preview,ScreenTransition.Fade)

 

and know i would need to include all form control fields.

When i try above it flashes failed screen then goes to BA1preview screen with error notification.

I would like it to stop on the failed screen with notification.

Am i getting the syntax right?

 

Thanks Gary
)

Super User
Super User

Re: Stuck with form required issue

Hi Gary,

To validate multiple fields, you would need to use the logical OR operator ( || ). The syntax would look like this:

If((IsBlank(rollnumber.Text) || IsBlank(assessorname.Selected.DisplayName) || IsBlank(candname.Selected.DisplayName)),
   Notify("Please enter all required fields", NotificationType.Error);
   Navigate(failed,ScreenTransition.Fade),
   Navigate(BA1preview,ScreenTransition.Fade
)

Hopefully, that'll fix your problem.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,410)