cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayManke
Skilled Sharer
Skilled Sharer

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.

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 News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,425)