Home > Mobile >  How to implement placeholder in a php file for moodle plugin?
How to implement placeholder in a php file for moodle plugin?

Time:05-13

Hello im new to moodle plugin development and I need to make the "Enter course schedule here..." in the third line disappear when I enter text. If im not mistake it is called placeholder but i dont know how to implement to.

Php code in my own moodle plugin

CodePudding user response:

Try:

$mform->addElement('text', 'sched_code', 'Schedule Code', ['placeholder' => 'Enter course schedule here...']);

Although, you will want to use get_string() for both bits of text that are being output, rather than hard-coding them like that, so that they can be translated / customised as required.

CodePudding user response:

Try wrapping the placeholder into [htmlplaceholder tag].

sample HTML placeholder tag

  • Related