web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Submit only if 2 crite...
Power Apps
Answered

Submit only if 2 criteria are fulfilled

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

 Hi, 

I have a form with an attachments field, which is only a required field when another option is false.

I am currently hiding the 'Submit' button until all required fields are complete - except the attachments fields, as that is only required some of the time. 

Many of my users are submitting a form which requires an attachment, but they don't attach anything, so the 'Submit' button is visable and can be selected, which takes them to the success screen even though their submission has actually not gone through.

 

I would like the 'Submit' button to only navigate to the success screen if it is successful, so far I have this (which doesn't work):

OnSelect = If(And(!IsEmpty(attachmentDataCard.Attachment), (DataCardValue1.Value=false)),disable,SubmitForm(Form1);Navigate(SuccessScreen,Fade)

 

Please can anyone help?

Submit only if xx=false and attachment is attached

 

Many thanks

Categories:
  • KrishnaV Profile Picture
    5,023 on at

    Hi @Anonymous ,

     

    Try this:

    If(And(!IsEmpty(attachmentDataCard.Attachment), (DataCardValue1.Value=false)),SubmitForm(Form1);Navigate(SuccessScreen,Fade))

    Now on the visible property of the button set the below variable: 

    If(And(!IsEmpty(attachmentDataCard.Attachment), (DataCardValue1.Value=false)),true,false)

    Now we are enabling the submit only if our conditions are met.


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks @KrishnaV !

     

    I have put your suggested code:

    If(And(!IsEmpty(attachmentDataCard.Attachment), (DataCardValue1.Value=false)),SubmitForm(Form1);Navigate(SuccessScreen,Fade))

    into the 'OnSelect' for my Submit button, however it returns the same error I was getting before - 'The function 'IsEmpty' has some invalid arguments'.

    Did I put the code in the wrong place?

     

    Thanks so much for your help! Neets

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    You just need to make a little change.

    set the submit button's OnSelect:

    If(And(!IsEmpty(DataCardValue16.Attachments), (DataCardValue1.Value=false)),SubmitForm(Form1);Navigate(SuccessScreen,Fade))

    // DataCardValue16 is the attachments control's name, please replace with yours.

    set the submit button's Visible:

    If(And(!IsEmpty(DataCardValue16.Attachments), (DataCardValue1.Value=false)),true,false)

     // DataCardValue16 is the attachments control's name, please replace with yours.

     

     

    Best regards,

  • KrishnaV Profile Picture
    5,023 on at

    Hi @Anonymous ,

     

    Please try this:

    If(And(CountRows(DataCardValue180.Attachments), (DataCardValue1.Value=false)),SubmitForm(Form1);Navigate(SuccessScreen,Fade))

    In the above formula DataCardValue180 is my control name please replace it with your control name.

     
    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi, thank you for the suggestion, this does remove the 'The function 'IsEmpty' has some invalid arguments' error. 

    However, it doesn't solve the original query: Submit only if xx=false and attachment is attached.

     

    I have solved with:

     

    If(Or(IsBlank(DataCardValue1),IsBlank(DataCardValue2),If(AttachemntDataCard.Attachment)false)),notify("Please fill in ALL the required fields",NotificationType.Error),SubmitForm(Form1);Navigate(SuccessScreen))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard