website logo
⌘K
Introduction
PORTAL
Agency Whitelabelling
PAGES
Pages - Accessing Page Data
Pagination Layouts
Page Templates
FORMS
Form Confirmation Pages
Adding a Progress Bar
Adding Custom CSS To Show Form Submit Process
Dynamic Content in Workflow and Autoresponder Emails
How to output Custom Field Set fields in a Form's Custom Layout
Custom JavaScript Validation for Forms
File Upload Previews
FAQ
CATEGORIES
Filtering WebApps and Modules by Categories
Outputting Categories on WebApp / Module / eCommerce Layouts
Outputting Category Fields in any Location
Category Detail Layouts
FAQ
COMPANY INFORMATION
Company Information
SITE SEARCH
Site Search
PUBLIC API/ZAPIER
Zapier - Formatting arrays correctly
Public API/Zapier Changelog
MODULES
Module Marketplace
Building Custom Modules
Siteglide Modules
Front-end Submit Modules
DATA STRUCTURES
Automations
Creating WebApps from the CLI
Field Types
WEBAPPS
Front-end Submit WebApps
Layouts
Search and Filtering
Understanding Custom Field Names and IDs
FAQ
CRM
User Details
User Secure Zones
Storing User's Favourite WebApp / Module Items
User's Form Submissions (Cases)
How Users Edit their Email and Password Front End
Editing a User's CRM record Front End with Custom Field Sets
CLI
Introducing Siteglide CLI
CLI Changelog
Secure Zones with CLI
Page Templates with Siteglide CLI
Pages with Siteglide CLI
Includes with Siteglide CLI
Managing Email Templates
Migrate - Manual Form setup
Migrate - Convert existing Forms
Liquid
Accessing Assets
Liquid Dot Notation
Using WebApp Collections- Tutorial
Using the current_user object with Secure Zones
Preventing Duplicate Content with Query Parameters- Canonical URL and Robots.txt
FAQ
GraphQL
Tutorial Overview
About GraphQL
Tutorial 1- Your First Query
Tutorial 2 - Pagination
Tutorial 3 - Filtering the Results
Tutorial 3 - Answers to the First Filtering Challenge
Tutorial 4 - Advanced Filtering
Tutorial 4 - Challenge Answers
Tutorial 5 - Using Liquid to run GraphQL queries on your Site
Tutorial 6 - Variables
Tutorial 6 - Answers to the Variables Challenge
Tutorial 7 - Sorting
Tutorial 8 - Building a Liquid API GET Endpoint Page powered by GraphQL queries
Best Practice and Performance
Module/WebApp Caching
Getting Started with Liquid Caching - to Reduce Server Response time and Improve Performance
Includes
ecommerce/checkout_standard
Frequently Asked Questions
Using Liquid Logic to Check if a field exists, or is empty on the Front End
How do I learn more about Liquid?
How to setup a multi domain start page
Docs powered by archbee 
12min

WebApps - Delete owned WebApps from front-end

Introduction

When your Users have created WebApp items front-end, you can now give them the option to delete the items they no longer need. A User will only be able to delete a WebApp item they own. Generally a User will own a WebApp item they've already created, but it's now possible to change WebApp ownership in Admin. You can use Liquid to further control when the button is presented to Users.

You can use optionally use JavaScript to change the behaviour when the button is successful, or when it errors.

Syntax

Including the button

To include the delete button, add the following syntax inside a WebApp Layout of your choice {% include "webapp_delete", layout: "default" %}

Nesting this inside a WebApp Layout allows it to easily pick up the ID of the current WebApp item.

Security

We recommend wrapping the Layout in the following Liquid to make sure the button is only visible to those Users who have the minimum permission needed to successfully delete the current item:

HTML
|

Note that on the backend we will be running an additional check that the WebApp ID passed through is owned by the currently logged in User- so it won't be possible for malicious Users to delete items they don't own by passing through different IDs.

Developing the Layout

Including the button in Liquid as above will require a small Layout- which allows you to customise the way the button looks and functions.

File Structure

Layouts for this button are stored at the following path: layouts/webapp_components/webapp_delete/my_layout.liquid

Calling the Main JavaScript Function

To make the delete button functional, you need to run the s_owned_webapp_delete() function on an event (usually a click event).

You should pass the following arguments:

Argument number

What is it?

Example

1

This WebApp ID

{{this.id}}

2

Token

{{token}}

3

Optional custom success callback function name

webapp_delete_success

4

Optional custom error callback function name

webapp_delete_fail

Customising the JavaScript

You can add custom JavaScript functions to customise the way the button behaves on success and failure. Examples are included on the default layout. If you don't provide custom functions, the default behaviour will be to:

  • On success, show a success message alert and reload the Page.
  • On failure, show an error message alert.

Here's an example of custom functions defined and then passed into the 3rd and 4th arguments in the function:

HTML
|

Note that the Siteglide Footer Scripts feature is a helpful tool to make sure your function definitions are only included in the Page once, avoiding duplicates as multiple iterations of the WebApp Layout are included on the Page. Just be aware that inline comments are not supported by this feature! Additionally, you could add in custom behaviour before the main delete function runs, for example to provide a confirmation message to Users to check they really want to delete the WebApp item:

HTML
|

Updated 19 Oct 2021
Did this page help you?
Yes
No
UP NEXT
Layouts
Docs powered by archbee 
TABLE OF CONTENTS
Introduction
Syntax
Including the button
Security
Developing the Layout
File Structure
Calling the Main JavaScript Function
Customising the JavaScript