Retrieve moodle form element value

Re: Retrieve moodle form element value

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There are huge numbers of examples in the Moodle code that you could follow.

As you've given very little information about what code you have, it is very difficult to say what you are missing.

I assume you've managed to get the form to display, so you already have something like:

$form = new nameOfMyFormClass();

Have you tried to retrieve the data from the form?

if ($formdata = $form->get_data()) {
}

If so, then the data you want is in $formdata->fieldname1