mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
4f46aff087
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r49161 | ischommer | 2008-02-07 14:25:07 +1300 (Thu, 07 Feb 2008) | 1 line avoid double escaping through attr*() and raw2att in createTag() ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52407 467b73ca-7a2a-4603-9d3b-597d59a354a9
44 lines
1.1 KiB
PHP
Executable File
44 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* @package forms
|
|
* @subpackage actions
|
|
*/
|
|
|
|
/**
|
|
* Action button with confirmation text.
|
|
* These button are useful for things like delete buttons.
|
|
* @package forms
|
|
* @subpackage actions
|
|
*/
|
|
class ConfirmedFormAction extends FormAction {
|
|
protected $confirmation;
|
|
|
|
/**
|
|
* Create a new action button.
|
|
* @param action The method to call when the button is clicked
|
|
* @param title The label on the button
|
|
* @param confirmation The message to display in the confirmation box?
|
|
* @param form The parent form, auto-set when the field is placed inside a form
|
|
*/
|
|
function __construct($action, $title = "", $confirmation = "Are you sure?", $form = null) {
|
|
$this->confirmation = $confirmation;
|
|
parent::__construct($action, $title, $form);
|
|
}
|
|
function Field() {
|
|
$attributes = array(
|
|
'type' => 'submit',
|
|
'class' => $this->extraClass(),
|
|
'id' => $this->id(),
|
|
'name' => $this->Name(),
|
|
'value' => $this->attrTitle(),
|
|
'tabindex' => $this->getTabIndexHTML(),
|
|
'onclick' => "return confirm('$this->confirmation');"
|
|
);
|
|
|
|
return $this->createTag('input', $attributes);
|
|
}
|
|
}
|
|
|
|
|
|
?>
|