Socket
Socket
Sign inDemoInstall

@juno0424/hapi

Package Overview
Dependencies
3
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @juno0424/hapi

Wrapper of Alpine JS plugin for HAPI Form, works on Laravel API endpoint. ## CDN ```html <script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script> <script src="https://unpkg.com/@juno0424/hapi@latest/dist/hapi.min.js"></script> ```


Version published
Weekly downloads
535
decreased by-0.37%
Maintainers
1
Install size
7.74 MB
Created
Weekly downloads
 

Readme

Source

HAPI Form Plugin

Wrapper of Alpine JS plugin for HAPI Form, works on Laravel API endpoint.

CDN

<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://unpkg.com/@juno0424/hapi@latest/dist/hapi.min.js"></script>

Usage

<script>
Hapi.form({
    name: "",
    endpoint: "",
    redirectTo: "",
    fileUpload: {
        filepond: filepondObject,
        el: '#files'
    },
    onSuccess(res) {},
    onFailed(err) {}
});
</script>
  • name – The name of the instance, to be matched with x-data="name".
  • endpoint – The form endpoint URL generated from the backend.
  • redirectTo – Location to be redirected after success. Eg: "/thank-you" or "https://example.com". (Optional)
  • fileUpload
    • filepond – Filepond object. (Filepond plugin required)
    • el – Select input element if you're using normal upload.
  • onSuccess() – On success event.
  • onFailed() – On failed event.

Array data

Hapi.form({
    fields: {
      colors; [] // Example an empty array of colors
    },
    name: "",
    endpoint: "",
});

Alpine.js data

Sometimes you might need to set data for Alpine.js, I got your back.

Hapi.form({
    ...
    open: false,
});

Events

Success Event

When submission is success, Hapi will emit hapi:success event.

Error Event

When submission has error, Hapi will emit hapi:error event.

FAQs

Last updated on 22 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc