cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayManke
Continued Contributor
Continued Contributor

Validate Two and If the Condition is True then Submit the Form, Else Show Notification

Hi All,

 

I am building an application which is having a form with only four fields. One Field is Event which is a dropdown and having two options only respectively 'Birthday' and 'Anniversary'.

 

To capture Birthday there is a separate 'Single Line of Text' column and for Anniversary there is a 'Date' Column.

 

What i want is if The DD selected value is 'Birthday' then the it should validate the data card with MM/DD Format and if 'Anniversary' is selected then it should allow to select the date in the respective field.

 

I am trying to use below examples of regular expression but somehow it is not working as expected. Can anyone please help how to achieve this?

 

Option 1

If(
    IsMatch(
        DataCardValue4.Text,
        "[0-9]{2}/[0-9]{2}"
    ),
    SubmitForm(NewItem),
    Notify(
        "Birth Date Must Be Entered in MM/DD Format.",
       TraceSeverity.Information
    )
)

 

Option 2

If(
DDEvent.Selected.Value = "Anniversary" And IsBlank(DataCardValue5), Notify("Enter Date in the Seniority Field"),
DDEvent.Selected.Value - "Birthday" And !IsMatch(DataCardValue4.Text, "[0-9]{2}\/[0-9]{2}"), Notify("Birth Date Must Be Entered in MM/DD 
Format."),
SubmitForm(NewItem))

 

Thanks,

Akshay

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

Option 2 looks good except that DDEvent.Selected.Value - "Birthday" should be DDEvent.Selected.Value = "Birthday"



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Jeff_Thorpe
Super User
Super User

Option 2 looks good except that DDEvent.Selected.Value - "Birthday" should be DDEvent.Selected.Value = "Birthday"



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
AkshayManke
Continued Contributor
Continued Contributor

Many Thanks @Jeff_Thorpe for highlighting my mistake. 🙂

It worked as expected after correcting as suggested by you. Hence accepting the solution.

 

Warm Regards,

Akshay

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,788)