cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Impactful Individual
Impactful Individual

'OR' INSIDE ON 'AND'

I have a If condition on my OnSelect (Button), but I need to verify if the condition is valid:

Here my code: 

 

If(
    FormNewValid.Valid && (StartsWith(TextInput1.Text; "https://")||StartsWith(TextInput2.Text; "http://"));
    SubmitForm(FormNewValid);;
    UpdateContext({varAddDataNew: false});;
    UpdateContext({varPopUpErro: true});
    Notify(
        "Please fill in the required field";
        NotificationType.Error
    );;UpdateContext({varErroHttp: true})
)

 

I just I wanna verify this part: 

 

If(
    FormNewValid.Valid && (StartsWith(TextInput1.Text; "https://")||StartsWith(TextInput2.Text; "http://"));
 

 

Thanks a lot!

I really need understand more about this!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Gorilla_8 

 

Updated to URL optional now.

 

 

If(
    FormNewCourseDontDelete.Valid && (IsBlank(DataCardValue26_4.Text) || (!IsBlank(DataCardValue26_4.Text) && IsMatch(
        DataCardValue26_4.Text,
        "^(http|https)://.*$"
    ))),
    SubmitForm(FormNewCourseDontDelete);
    UpdateContext({varErroHttp: false});
    UpdateContext({varNewFormAddCourse: false});
    UpdateContext({varPopAddDataInfo: true}),
    Notify(
        "Please fill in the required field before adding course dates",
        NotificationType.Error,
        3000
    );
    UpdateContext({varErroHttp: true})
)

 

 

View solution in original post

19 REPLIES 19
StalinPonnusamy
Community Champion
Community Champion

Hi @Gorilla_8 

 

Here is the meaning for the below condition

 

If(
    FormNewValid.Valid && (StartsWith(TextInput1.Text; "https://") || StartsWith(TextInput2.Text; "http://"));

 

 

  • Form is Valid
  • AND
  • Web Address starts with either HTTP OR HTTPS

Example

  • Valid form and "http://" - OK - Submit form
  • Valid form and "https://" - OK - Submit form

Other conditions fails

Gorilla_8
Impactful Individual
Impactful Individual

@StalinPonnusamy 

 

Thank for the quick response... 

Got an error: 

 

Gorilla_8_0-1634655192106.png

 

StalinPonnusamy
Community Champion
Community Champion

Hi @Gorilla_8 

 

Can you make sure the semicolon is used propery? here is my example and works fine

If(
    EditForm1.Valid && ((StartsWith(DataCardValue6.Text,"https://") || StartsWith(DataCardValue6.Text,"http://"))),
    SubmitForm(EditForm1),
    Notify("Not Valid")
)

 

StalinPonnusamy_0-1634656034030.png

 

Gorilla_8
Impactful Individual
Impactful Individual

Hi @StalinPonnusamy 

 

Gorilla_8_0-1634656397883.png

 

The semicolon are correct, I don't understand why have an error

 

One try... Can you close the app, clear the cache, and re-open it.

Gorilla_8
Impactful Individual
Impactful Individual

@StalinPonnusamy 

 

The same error

StalinPonnusamy
Community Champion
Community Champion

Hi @Gorilla_8 

 

Can you try this?

 

If(
    EditForm1.Valid && IsMatch(DataCardValue6.Text, "(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]"),
    SubmitForm(EditForm1),
    Notify("Not Valid")
)

 

Sample

StalinPonnusamy_1-1634666115390.png

 

 

Gorilla_8
Impactful Individual
Impactful Individual

@StalinPonnusamy 

 

I just need to verify if starts with: 

"https://" OR "http://"

 

Here : 

123.gif

StalinPonnusamy
Community Champion
Community Champion

Hi @Gorilla_8 

 

!IsBlank(TextInput10.Text) && IsMatch(TextInput10.Text, "^(http|https)://.*$")

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,094)