Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
MoodleQuickForm Class Reference

MoodleQuickForm implementation. More...

Inheritance diagram for MoodleQuickForm:

Public Member Functions

 __construct ($formName, $method, $action, $target='', $attributes=null, $ajaxformdata=null)
 Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless.
 
 accept (&$renderer)
 Accepts a renderer.
 
 addAdvancedStatusElement ($headerid, $showmore=false)
 Use this method to add show more/less status element required for passing over the advanced elements visibility status on the form submission.
 
 addGroupRule ($group, $arg1, $type='', $format=null, $howmany=0, $validation='server', $reset=false)
 Adds a validation rule for the given group of elements.
 
 addHelpButton ( $elementname, $identifier, $component='moodle', $linktext='', $suppresscheck=false, $a=null)
 Add a help button to element, only one button per element is allowed.
 
 addRule ($element, $message, $type, $format=null, $validation='server', $reset=false, $force=false)
 Adds a validation rule for the given field.
 
 closeHeaderBefore ($elementName)
 Adds one or more element names that indicate the end of a fieldset.
 
 disable_form_change_checker ()
 Call this method if you don't want the formchangechecker JavaScript to be automatically initialised for this form.
 
 enable_form_change_checker ()
 If you have called disable_form_change_checker() then you can use this method to re-enable it.
 
 exportValues ($elementList=null)
 export submitted values
 
 filter_shown_headers (array $shownonly)
 Use this method to indicate that the fieldsets should be shown and expanded and all other fieldsets should be hidden.
 
 getAdvancedHTML ()
 Returns HTML for advanced elements.
 
 getCleanedValue ($value, $type)
 Return the cleaned value using the passed type(s).
 
 getCleanType ($elementname, $value, $default=PARAM_RAW)
 Return the type(s) to use to clean an element.
 
 getReqHTML ()
 Returns HTML for required elements.
 
 getShowAdvanced ()
 This function has been deprecated.
 
 getValidationScript ()
 Returns the client side validation script.
 
 is_dirty ()
 Is the form currently set to dirty?
 
 is_form_change_checker_enabled ()
 
 is_shown (string $headername)
 Use this method to check if the fieldsets could be shown.
 
 MoodleQuickForm ($formName, $method, $action, $target='', $attributes=null)
 Old syntax of class constructor.
 
 optional_param ($name, $default, $type)
 Checks if a parameter was passed in the previous form submission.
 
 set_initial_dirty_state ($state=false)
 Set the initial 'dirty' state of the form.
 
 set_sticky_footer (?string $elementname)
 Use this method to indicate an element to display as a sticky footer.
 
 setAdvanced ($elementName, $advanced=true)
 Use this method to indicate an element in a form is an advanced field.
 
 setConstant ($elname, $value)
 Set constant value not overridden by _POST or _GET note: this does not work for complex names with [] :-(.
 
 setDefault ($elementName, $defaultValue)
 Initializes a default form value.
 
 setDisableShortforms ($disable=true)
 Use this method to indicate that the form will not be using shortforms.
 
 setExpanded ($headername, $expanded=true, $ignoreuserstate=false)
 Use this method to indicate that the fieldset should be shown as expanded.
 
 setForceLtr ($elementname, $value=true)
 Set an element to be forced to flow LTR.
 
 setShowAdvanced ($showadvancedNow=null)
 This function has been deprecated.
 
 setType ($elementname, $paramtype)
 Should be used for all elements of a form except for select, radio and checkboxes which clean their own data.
 
 setTypes ($paramtypes)
 This can be used to set several types at once.
 
 updateSubmission ($submission, $files)
 Updates submitted values.
 

Public Attributes

array $_advancedElements = array()
 Array whose keys are element names.
 
array $_cancelButtons =array()
 Array of buttons that if pressed do not result in the processing of the form.
 
array $_collapsibleElements = array()
 Array whose keys are element names and values are the desired collapsible state.
 
array $_dependencies = array()
 dependent state for the element/'s
 
boolean $_disableShortforms = false
 Whether to enable shortforms for this form.
 
string $_formName = ''
 The form name is derived from the class name of the wrapper minus the trailing form It is a name with words joined by underscores whereas the id attribute is words joined by underscores.
 
array $_noSubmitButtons =array()
 Array of buttons that if pressed do not result in the processing of the form.
 
string $_pageparams = ''
 String with the html for hidden params passed in as part of a moodle_url object for the action.
 
array $_types = array()
 type (PARAM_INT, PARAM_TEXT etc) of element value
 
const DEP_DISABLE = 0
 Is this a 'disableIf' dependency ?
 
const DEP_HIDE = 1
 Is this a 'hideIf' dependency?
 

Protected Member Functions

 prepare_fixed_value ($name, $value)
 This is a bit of a hack, and it duplicates the code in HTML_QuickForm_element\_prepareValue, but I could not think of a way or reliably calling that code.
 

Protected Attributes

string $_advancedHTML
 advanced class HTML.
 
array $_ajaxformdata
 $_ajaxformdata submitted form data when using mforms with ajax
 
array $_hideifs = array()
 elements that will become hidden based on another element
 
bool $_initial_form_dirty_state = false
 The initial state of the dirty state.
 
array $_newrepeats = array()
 names of new repeating elements that should not expect to find submitted data
 
string $_reqHTML
 request class HTML.
 
array $_shownonlyelements = []
 Array whose keys are the only elements to be shown.
 
string null $_stickyfooterelement = null
 The form element to render in the sticky footer, if any.
 
bool $_use_form_change_checker = true
 whether to automatically initialise the form change detector this form.
 
bool $clientvalidation = false
 Whether the form contains any client-side validation or not.
 

Detailed Description

MoodleQuickForm implementation.

You never extend this class directly. The class methods of this class are available from the private $this->_form property on moodleform and its children. You generally only call methods on this class from within abstract methods that you override on moodleform such as definition and definition_after_data

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

The documentation for this class was generated from the following file: