Thank you for visiting my site!

Home / PowerApps - Forms / Form validation

Form validation

If You using forms (Start Custom form from the SharePoint List), prepare the validation:
  1. On screen Visible
    set the default variable to show error

    [code]UpdateContext({

    showValTask: false,
    showValSomeOther: false,
    ….
    });[/code]

  2. Set the Text property for the error message
  3. set error label
    Visible = showValTask
  4. Hide the validation on the InputBox when do any changes
    OnChange UpdateContext({ showValTask: false})

     

  5. Finally do the validation OnSave [code] If(showValTask || showValDescription || …… ,
    UpdateContext({locIsAllValid: false}),
    UpdateContext({locIsAllValid: true})
    );

    If(
    !locIsAllValid,
    Notify(
    "An Form entry is required or has an invalid value. Please correct and try again.",
    NotificationType.Error,
    4000
    )
    );

    If(
    locIsAllValid,
    SubmitForm(frmNew);
    UpdateContext({locRecord: frmNew.LastSubmit});
    Refresh(Submissions)
    );
    If(
    locRecord.ID > 0,
    Notify(
    "Deliverable has been Updated!",
    Success,
    5000
    );
    Navigate(scrGalleries, ScreenTransition.Cover);

    ) [/code]

ADD YOUR COMMENT