Moodle

Required fields claimed even when not shown

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.5
  • Fix Version/s: None
  • Component/s: Forms Library
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

create a moodleform
add a field like, for instance:

$mform->addElement('text', 'fieldname', get_string('fieldname','newmodule'));
$mform->addRule('fieldname', get_string('required'), 'required', null, 'client');

Be sure this is the ONLY required field.

In the function definition_after_data() {
type:
if ($mycondition) { $mform->removeElement('fieldname'); }

Run the form.
Even if $mycondition == true
at the bottom of the form in the web browser it is written:

There are required fields in this form marked*

Activity

Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Daniele Cordella added a comment -

This issue is still valid in current head (Moodle 2.3).
The attached test.php file demonstrate it.
(copy it to moodle root and call it from a browser)

Show
Daniele Cordella added a comment - This issue is still valid in current head (Moodle 2.3). The attached test.php file demonstrate it. (copy it to moodle root and call it from a browser)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: