# button

```php
/**
 * Create a Bootstrap form-button.
 *
 * @param unknown $name
 * @param string $label
 * @param string $value
 * @param string $type
 *        	[button|submit|reset]
 * @param array $options
 *        	[
 *        	'class' => 'btn btn-default',
 *        	'iconclass' => 'glyphicon glyphicon-floppy-saved',
 *        	'formaction' => 'modules.php?op=xyz',
 *        	'confirm' => [
 *            'tool'      => ''   // ['' | 'bootstrap-confirmation']
 *        	  'confirm_1' => af_tran ( 'Die Freigabe wird zurückgenommen!' ),
 *        	  'confirm_2' => af_tran ( 'Wollen Sie die Freigaben wirklich zurücknehmen?' )
 *        	  ]
 *        	]
 * @return string
 */
public function button($name, $label = null, $value = null, $type = 'button', array $options = []) {
	...
}

```

### Parameter für das button Objekt

| Name     |          | Beschreibung                                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| $name    |          | Name des Butons. Dieser wird beim Senden des Formulars in `$_GET` übergeben.                                                                                                                                                                                                                                                                                                                                                                |
| $label   | optional | Beschriftung der Schaltfläche / des Buttons. Wird kein `$label` übergeben, so wird `$name` als Label übernommen.                                                                                                                                                                                                                                                                                                                            |
| $value   |          | Wert des button-Feldes. Dieser Wert wird beim Senden des Formulars in $name übergeben.                                                                                                                                                                                                                                                                                                                                                      |
| $type    |          | HTML-Buttontype: 'button', 'submit', ...                                                                                                                                                                                                                                                                                                                                                                                                    |
| $options | optional | <ol><li>Array mit Optionen / Attributen zu einem input-Feld. Hier sind grundsätzlich alle HTML-Attribute erlaubt. </li><li>Spezifische Optionen:<br>'confirm' <code>=> \[]</code> : Parameter für einenn "Confirm-Button".</li><li>Weiterhin können interne Optionen eingetragen werden, welche die Darstellung des Input-Feldes beeinflussen. <br><a href="/pages/-La_ZqCaTGcWGL4-MvjG">Optionale Parameter für input-Felder</a></li></ol> |

### Button - Confirm

Falls zur Bestätigung einer Aktion durch eine Schaltfläche eine Sicherheitsabfrage / Bestätigung erforderlich ist, so kann dies mit der Option `'confirm' => []` definiert werden!

| Option     | Wert  | Beschreibung                                                                                                                                                                                    |
| ---------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| confirm\_1 | Text  | Bestätigungstext für die erste Abfrage                                                                                                                                                          |
| confirm\_2 | Text  | <p>Bestätigungstext, falls es eine 2te Bestätigung geben soll. </p><p><em>Nicht für Bootstrap-Confirmation</em></p>                                                                             |
| tool       | Array | In dem optionalen Array kann die Darstellungsform / Tool für die Bestätigung definiert werden. Aktuell gibt es die **Browser-Confirmation** (default) und das Tool "**Bootstrap-Confirmation**" |

#### Browser-Confirmation

Bei dieser (default) Option wird die Browser-Funktion `confirm()` aufgerufen.

![Browser-Bestätigung: Das System ruft die Funktion confirm() des Browsers auf...](/files/-Lpi5AMifBOx2xHFRYVt)

```php
$FormHtml [] = $FrmObj->button ( 'frm_save', af_tran ( 'Browser-Bestätigung' ), 'user/pick_send', 'submit', array (
		'class' => 'btn btn-success',
		'iconclass' => 'fa fa-envelope fa-check-circle-o',
		'id' => 'btn_save_and_unsend_id',
		'title' => af_tran ( 'Bestätigung mit Browser-Alert' ),
		'confirm' => [
				'confirm_1' => af_tran ( 'Komissionierung wird abgeschlossen: eMail an den Besteller wird versendet!' ),
				'confirm_2' => af_tran ( 'Wollen Sie die Komissionierung abschliessen und eine eMail versenden?' )
		]
) );
```

#### Bootstrap-Confirmation

Diese Option nutzt das Plugin **Boots-Confirmation**, weitere Informationen gibt es hier:

[Git (mistic100 / Bootstrap-Confirmation)](https://github.com/mistic100/Bootstrap-Confirmation)  [Doku und Beispiele](http://bootstrap-confirmation.js.org/)

![](/files/-Lpi7B5DOOPfEFfhJI3x)

```php
$FormHtml [] = $FrmObj->button ( 'frm_save', af_tran ( 'bootstrap-confirmation-Tool' ), 'user/pick_send', 'submit', array (
		'class' => 'btn btn-success',
		'iconclass' => 'fa fa-envelope fa-check-circle-o',
		'id' => 'btn_test_bootbox_id',
		'title' => af_tran ( 'Bestätigung mit (bootstrap-confirmation)' ),
		'confirm' => [
				'tool' => [
						'toolname' => 'bootstrap-confirmation',
						'btnOkLabel' => 'O.K.',
						'btnCancelLabel' => 'Abbrechen'
				],
				'confirm_1' => af_tran ( 'Die Freigabe wird zurückgenommen!' )
		]
) );
```

| Option           | Werte                    | Beschreibung                                                                                                              |
| ---------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| toolname         | 'bootstrap-confirmation' | Wählt das Plugin "**bootstrap-confirmation**" aus.                                                                        |
| btnOkLabel       | string                   | Label of the "Ok" button.                                                                                                 |
| btnOkClass       | string                   | Class of the "Ok" button.                                                                                                 |
| btnOkIconClass   | string                   | Icon-Class of the "Ok" button                                                                                             |
| btnOkIconContent | string                   | Icon content of the "Ok" button.                                                                                          |
| html             | 'true'\|'false'          | Falls die Nachricht (confirm\_1) als HTML-Text ausgegeben werden soll, muss dieser Parameter auf **true** gesetzt werden! |
| weitere          |                          | siehe [bootstrap-confirmation.js.org](http://bootstrap-confirmation.js.org/)                                              |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alaniso-de.gitbook.io/alaf-framework/untitled/button.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
