# j-InlineForm

> New version of this component supports dynamic evaluation of the content of <script type='text/html'>. The example below contains a script with HTML and the component evaluates the content if the j-In

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 684bfd52fc5849058377eb77c47c96d5f577eba8365e45917a511cc797e6bdf2
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- Works with Bootstrap
- The component moves the content of this component under `<body>` tag (because of positioning)

__Configuration__:

- `title` {String} form title
- `width` {Number} form max-width
- `icon` {String} Total icon without `ti-` or the whole declaration e.g. `ti ti-home`
- `reload` {String} a link to a global function and it's executed if the form is showing
- `submit` {String} a link to a global function and it's executed if the submit button is pressed
- `cancel` {String} a link to a global function and it's executed if the cancel button is pressed
- `hide` {String} a link to a global function and it's executed if the form is hiding
- `enter` {Boolean} captures `enter` key automatically and performs submit (default: `false`)
- `default` {String} a short alias for `DEFAULT(default, true)`
- `autohide` {Boolean} enables auto-hide (default: `true`)
- `autofocus` {Boolean} performs auto-focus to nearest input (default: `false`)

__Methods__:

- `instance.show(opt)` - shows the form
	- `opt.element` {jQuery element} element
	- `opt.align` {String} can be `left` (default), `right` or `center`
	- `opt.offsetX` {Number} offsetX (default: `0`)
	- `opt.offsetY` {Number} offsetY (default: `0`)
	- `opt.position` {String} can be `top` (default) or `bottom`
	- `opt.callback` {Function} a user defined function `callback(hide)`, `hide` attribute is `function`
- `instance.hide()` - hides the form

__Good to know__:

New version of this component supports dynamic evaluation of the content of `<script type="text/html">`. The example below contains a script with HTML and the component evaluates the content if the j-InlineForm will be displayed (only once).

```html
<div data---="inlineform">
	<script type="text/html">
		A CONTENT
	</script>
</div>
```

Use it with `<ui-component name="inlineform">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<a href="javascript:void(0)" class="exec">Show inline form</a>

<ui-component name="inlineform" config="width:250;title:Title;submit:userform_submit" class="hidden">
	<div style="padding:10px 15px">SOME CONTENT</div>
	<nav>
		<button name="submit">SUBMIT</button>
		<button name="cancel">CANCEL</button>
	</nav>
</ui-component>

<script>

	function userform_submit(hide) {
		alert('SUBMIT');
		hide();
	}

	$(document).on('click', '.exec', function() {
		var opt = {};
		opt.element = $(this);
		opt.align = 'left';
		SETTER('inlineform', 'show', opt);
	});
</script>
```
