artroot/form-tools

Plugin simple cloning of nodes by template

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

dev-master 2018-10-31 23:04 UTC

This package is not auto-updated.

Last update: 2024-05-07 14:50:33 UTC


README

The simple cloning of node by template.

  • Declarative style of defining bindings and rules;
  • Flexibility of template.

Try to use formTools when you need to generate fields in your input form, for example massive of users / items.

Example

Clone pattern attributes description:

  • cp-init - the initialization area of the form or block;
  • cp-options - list of options and rules;
  • cp-viewport - the area where the cloned nodes will be added;
  • cp-template - the cloned template;
  • cp-inputs - area of input fields, in which data will be inserted;
  • cp-add - the button for adding a cloned node;
  • cp-rm - delete node button
  • cp-counter - node counter

Just follow this structure:

<form cp-init="userList" cp-options="{minNode:1}">
	<span cp-add>Clone</span>
	<div cp-viewport>
		<div cp-template>
			<div cp-inputs>
	  			<label cp-counter>1</label>
	    			<input type="text" name="name[]">
	    			<input type="email" name="email[]">
	    			<span cp-rm></span>
			</div>
		</div>
	</div>
</form>

More examples and documentation you can see in my website https://docs.artsemenishch.com.ua/projects/js/form-tools/

Installation

With composer

composer require artroot/form-tools

Regular Setup

To install formTools, just download the form-tools.min.js script and add into your head tag.

<script src="path/to/form-tools.min.js"></script>

or use these links.

<script src="https://libs.artsemenishch.com.ua/js/form-tools/form-tools.min.js"></script>

License

This project is licensed under the MIT License - see the LICENSE file for details