cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FoOtY1337
New Member

Submitting form with error handling

Hello all! I'm still learning PowerApps. I'm trying to create a form with some basic error handling. It working at the moment but it always throws me the error message even though it did patch the datasource correcly. I think I'm overlooking something but can't really seem to find the culprit.

 

My code is as follows:

 

If (
IsBlank(tbNameDesk.Text);Notify("Vul het veld ""Naam"" in...");
IsBlank(tbFloorDesk.Text);Notify("Vul het veld ""Verdieping"" in...");
IsBlank(tbMapDesk.Text);Notify("Vul het veld ""Plattegrond URL"" in...");
IsBlank(tbDescrDesk.Text);Notify("Vul het veld ""Beschrijving"" in...");

Patch(
    Desks;
    varManageSelectedDesk;
    {
        Title: tbNameDesk.Text;
        Floor:tbFloorDesk.Text;
        'Map Link':tbMapDesk.Text;
        Description:tbDescrDesk.Text;
        Active:toggleActive.Value
    }
);;

If(
    IsEmpty(Errors(Desks));
    // on success
    Navigate(ManageDesks)
    );

    // on failure
    Notify(
        "Fout: Er is iets mis gegaan";
        NotificationType.Error
    );

Reset(toggleActive);;
Reset(tbDescrDesk);;
Reset(tbMapDesk);;
Reset(tbFloorDesk);;
Reset(tbNameDesk);;
Set(
    varDeskMode;
    Blank()
);
Set(
   varManageSelectedDesk;
    Blank()
);;
)

 

It always throws me the error "Fout: Er is iets mis gegaan".

 

Any help would be greatly appreciated! And also in general; is this a good way to do it? 🙂

1 REPLY 1
gabibalaban
Dual Super User
Dual Super User

@FoOtY1337 ,

My feeling is that you have a small syntax confusion on the second if. There should be ;; instead of ; . Try this :

If (
IsBlank(tbNameDesk.Text);Notify("Vul het veld ""Naam"" in...");
IsBlank(tbFloorDesk.Text);Notify("Vul het veld ""Verdieping"" in...");
IsBlank(tbMapDesk.Text);Notify("Vul het veld ""Plattegrond URL"" in...");
IsBlank(tbDescrDesk.Text);Notify("Vul het veld ""Beschrijving"" in...");

Patch(
    Desks;
    varManageSelectedDesk;
    {
        Title: tbNameDesk.Text;
        Floor:tbFloorDesk.Text;
        'Map Link':tbMapDesk.Text;
        Description:tbDescrDesk.Text;
        Active:toggleActive.Value
    }
);;

If(
    IsEmpty(Errors(Desks; varManageSelectedDesk));
    // on success
    Navigate(ManageDesks)
    );

    // on failure
    Notify(
        "Fout: Er is iets mis gegaan";
        NotificationType.Error
    );;

Reset(toggleActive);;
Reset(tbDescrDesk);;
Reset(tbMapDesk);;
Reset(tbFloorDesk);;
Reset(tbNameDesk);;
Set(
    varDeskMode;
    Blank()
);
Set(
   varManageSelectedDesk;
    Blank()
);;
)

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,150)