button
Das Formularelement vom Type "button" erstellt Schaltflächen / Buttons in einem Formular
/**
* 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
Array mit Optionen / Attributen zu einem input-Feld. Hier sind grundsätzlich alle HTML-Attribute erlaubt.
Spezifische Optionen: 'confirm'
=> []
: Parameter für einenn "Confirm-Button".Weiterhin können interne Optionen eingetragen werden, welche die Darstellung des Input-Feldes beeinflussen. Optionale Parameter für input-Felder
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
Bestätigungstext, falls es eine 2te Bestätigung geben soll.
Nicht für Bootstrap-Confirmation
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.

$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) Doku und Beispiele

$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!
Last updated
Was this helpful?