powerappssharepoint-list

SharePoint List Power Apps Custom Form - URL Field resets form on failure instead of displaying error


I am creating a custom form for a sharepoint list in power apps. In the sharepoint list, I have a URL type column. I have added that card into the custom form in power apps, however when I try to use the custom form and enter in a non url into the url card, I get the error at the top of the form:

"Network error when using Patch function: The requested operation is invalid."

If I am editing an existing row, then it resets the form as well.

I saw another post explaining how to display an error with regex:

IsMatch(Object.Text, "(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$")

But I am unsure how to block the form submitting (because this brings up that error that users won't understand and also resets the form). Does anyone know how to do this?


Solution

  • On submit button try this formula

    If(IsMatch(DataCardValue24.Text, "(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$")=true,SubmitForm(EditForm1),Notify("Proper Url must be entered in URL field"))
    

    enter image description here