silverstripe-framework/forms/AjaxFormAction.php
Ingo Schommer 9e98f127f2 Merged revisions 47613 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq

........
  r47613 | ischommer | 2008-01-04 19:14:58 +1300 (Fri, 04 Jan 2008) | 1 line
  
  adding tabIndex capabilities, switching HTML-rendering to createTag()
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52199 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-04-06 04:08:45 +00:00

42 lines
1004 B
PHP
Executable File

<?php
/**
* @package forms
* @subpackage actions
*/
/**
* Action button with Ajax/JavaScript overloading.
* @package forms
* @subpackage actions
*/
class AjaxFormAction extends FormAction {
protected $ajaxAction;
/**
* 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 = "", $ajaxAction = null, $form = null) {
$this->ajaxAction = $ajaxAction ? $ajaxAction : $action;
parent::__construct($action, $title, $form);
}
function Field() {
return $this->createTag('input', array(
'class' => "ajaxAction-$this->ajaxAction action",
'id' => $this->id(),
'type' => 'submit',
'value' => $this->title,
'tabindex' => $this->getTabIndexHTML()
));
}
function Title() {
return false;
}
}
?>