Moodle

Can't use 'createElement' with 'htmleditor' element type

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.8, 1.9
  • Fix Version/s: None
  • Component/s: Forms Library
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

If you try to add an 'htmleditor' form element, using 'createElement' (for use in a group, for example), it generates the error:

"Fatal error: Call to undefined method [caller object]::getAttribute() in [moodleroot]/lib/form/textarea.php on line 73"

'addElement' does work.

It appears that there is a specific trap for 'createElement' event in the '/lib/form/textarea.php' that is trying to use the getAttribute method on the caller object. This object may not have this method, and its likely its assuming a different caller anyway (probably from addElement?).

I used a workaround to use getAttribute only if the caller variable is an object and has that method, but I don't think that's the correct solution. Not sure what should be done.

This workaround will not let me use setHelpButton on the 'htmleditor' though.

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
Michael de Raadt added a comment -

I'm closing this issue as it has become inactive and does not appear to affect a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it has become inactive and does not appear to affect a current supported version. If you are encountering this problem or one similar, please launch a new issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: