Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fliplet/fliplet-widget-form
https://github.com/fliplet/fliplet-widget-form
Last synced: about 4 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/fliplet/fliplet-widget-form
- Owner: Fliplet
- Created: 2016-10-06T15:42:02.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-22T08:50:50.000Z (over 3 years ago)
- Last Synced: 2023-08-02T02:34:10.524Z (over 1 year ago)
- Language: JavaScript
- Size: 197 KB
- Stars: 0
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fliplet Form Component
## Instances
You can access form instances
```js
var formInstance = Fliplet.Widget.get('com.fliplet.form').forms(UUID);
```## Dev Options
### Map form fields before sent
`fields` is an object containing all the fields to be submitted, excluding `type="file"` fields.
```js
formInstance.mapData = function(fields) {
// fields @Object
return fields;
}
```### Custom submission send
You can choose not to use our default submit data and create your own.
This MUST return a Promise if you want us to show our default form submission confirmation.```js
formInstance.submit = function(data) {
// Do whatever to data
return Promise.resolve();
}
```### Post-submission hooks
Whether you are using the default submission process or your own, you can have an event listener for when submissions are successful.
```js
formInstance.onSubmit().then(function(){
// Submission was a huge success. Celebrate.
});
```### TinyMCE and customisation
Add a `` field with the `data-tinymce` attribute to create a textarea that supports full formatting support.
You can also add new TinyMCE or custom plugins by creating a custom `formInstance.onBeforeTinyMCEInit()` promise. `tinymce` must be added to the page dependency for this to work.
```js
formInstance.onBeforeTinyMCEInit() = function () {
var opts = {
plugins: 'mycustomplugin',
toolbar: 'mycustomplugin'
};
return Promise.resolve(opts);
}
```