[go: up one dir, main page]

Skip to content

tamila-ambeon/FORM-GRABBER

Repository files navigation

Form Grabber

Easy way to collect data from inputs, send to the server and handle response.
Componens are compiled with webpack to single files:

public/form-grabber-bundle.css
public/form-grabber-bundle.js

Run compilation:

npx mix

Usage

Add scripts:

<!--- Form grabber library: ---->
<link href="{{URL::to('/')}}/form-grabber-bundle.css" rel="stylesheet">
<script src="{{URL::to('/')}}/form-grabber-bundle.js"></script>

Set base:

<base href="{{URL::to('/')}}">

Copy templates from folder: view/forms.

Create file .js with extends class:

class MainInfo extends FormGrabber
{
    beforeSend() {}
    onSuccess(json) {}
    onError(error) {}
}

try {
    let mainInfo = new MainInfo({
        // "debug": true,
        'button_id': "my_info_button",
        // 'switch_button_id': "waiting_button",
        'input_ids': [],
        'method': "PATCH",
        'endpoint': document.getElementsByTagName("base")[0].href + "api/test-form-input"
    })
} catch (e) {
    console.log('Error while creating form listener: ', e)
}

Tamila Ambeon

About

Документація_по_формам

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published