# j-Prompt

> Die Komponente (Singleton) zeigt ein Eingabeaufforderungsfenster mit einzeiliger oder mehrzeiliger Eingabe an.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: de
Content-SHA256: 3fd3fdfbea7d23375a691409d46047e3eefd8d2e63c98a721d7b6f7792e89d3d
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Die Komponente (Singleton) zeigt ein Eingabeaufforderungsfenster mit einzeiliger oder mehrzeiliger Eingabe an.


__Konfiguration__:

- `zindex {Number}` optional (Standard: `12`)
- `width {Number}` optional, max. Breite (Standard: `400`)
- `cancel {String}` optional, Beschriftung für den Abbrechen-Button (Standard: `Cancel`)
- `submit {String}` optional, Beschriftung für den Submit-Button (Standard: `OK`)

__Beispiel__:

```js
var opt = {};
opt.name = 'A title'; // optional
opt.summary = 'A small sumarization'; // optional
opt.value = ''; // a default value, optional
// opt.type = 'password'; // only for single-line mode
// opt.width = config.width; // max. width, optional
// opt.zindex = config.zindex; // a custom zindex, optional
// opt.centered = true; // centers the window to the middle of the screen
// opt.newbie = true; // allows to submit a default value
// opt.multiline = true; // NEW: enables textarea with 3 rows
// opt.monospace = true; // NEW: enables monospace text

opt.cancel = function(val) {
	// @val {String}
	// prompt is canceled
};

opt.callback = function(val) {
	// @val {String}
	// changed
};

opt.hide = function() {
	// prompt is hidden/closed
};

SETTER('prompt/show', opt);
```

Verwenden Sie es mit `<ui-component name="prompt">`. Wenn die Komponente noch nicht geladen ist, lädt jComponent sie bei der ersten Verwendung von der Adresse in `DEF.fallback` herunter (standardmäßig das CDN Componentator). Autor: Peter Širka. Quelle: Componentator-Komponenten-Repository, MIT-Lizenz.

```html example.html
<ui-component name="prompt"></ui-component>

<script>
	setTimeout(function() {
		var opt = {};
		opt.name = 'Folder name';
		opt.summary = 'Enter a folder name for your documents:';
		opt.value = '';

		opt.callback = function(val) {
			console.log('Returned', val);
		};

		opt.cancel = function(val) {
			console.log('Canceled', val);
		};

		opt.hide = function() {
			console.log('Hidden');
		};

		SETTER('prompt/show', opt);
	}, 1000);
</script>
```
