MDL-9891 new 'clonepermissionsfrom' key in access.php
[moodle.git] / lib / form / submit.php
CommitLineData
a23f0aaf 1<?php
2require_once("HTML/QuickForm/submit.php");
3
4/**
5 * HTML class for a submit type element
6 *
7 * @author Adam Daniel <adaniel1@eesus.jnj.com>
8 * @author Bertrand Mansion <bmansion@mamasam.com>
9 * @version 1.0
10 * @since PHP4.04pl1
11 * @access public
12 */
13class MoodleQuickForm_submit extends HTML_QuickForm_submit {
14 /**
15 * Called by HTML_QuickForm whenever form event is made on this element
16 *
17 * @param string $event Name of event
18 * @param mixed $arg event arguments
19 * @param object $caller calling object
20 * @since 1.0
21 * @access public
22 * @return void
23 */
24 function onQuickFormEvent($event, $arg, &$caller)
25 {
26 switch ($event) {
27 case 'createElement':
28 parent::onQuickFormEvent($event, $arg, $caller);
29 if ($caller->isNoSubmitButton($arg[0])){
30 //need this to bypass client validation
31 //for buttons that submit but do not process the
32 //whole form.
33 $onClick = $this->getAttribute('onclick');
34 $skip = 'skipClientValidation = true;';
35 $onClick = ($onClick !== null)?$skip.' '.$onClick:$skip;
36 $this->updateAttributes(array('onclick'=>$onClick));
37 }
38 return true;
39 break;
40 }
41 return parent::onQuickFormEvent($event, $arg, $caller);
42
43 } // end func onQuickFormEvent
44}
45?>