Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]

Radio input form element.

Copyright: 2013 David MonllaĆ³
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 91 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 lib/behat/form_field/behat_form_checkbox.php

Defines 1 class

behat_form_radio:: (2 methods):
  get_value()
  set_value()


Class: behat_form_radio  - X-Ref

Radio input form field.

Extends behat_form_checkbox as the set_value() behaviour
is the same and it behaves closer to a checkbox than to
a text field.

This form field type can be added to forms as any other
moodle form element, but it does not make sense without
a group of radio inputs, so is hard to find it alone and
detect it by behat_field_manager::get_form_field(), where is useful
is when the default behat_form_field class is being used, it
finds a input[type=radio] and it delegates set_value() and
get_value() to behat_form_radio.

get_value()   X-Ref
Returns the radio input value attribute.

Here we can not extend behat_form_checkbox because
isChecked() does internally a (bool)getValue() and
it is not good for radio buttons.

return: string The value attribute

set_value($value)   X-Ref
Sets the value of a radio

Partially overwriting behat_form_checkbox
implementation as when JS is disabled we
can not check() and we should use setValue()

param: string $value
return: void