Hi!, I'm new in moodle and always programmed at client-side. I think maybe I'm missing something because of that reason. I need to provide the user with diverse UI elements, according to what he selects in a combo. I was trying with something like this:
$this -> _form -> addElement('select', 'displayStrategy', get_string('displayStrategy', 'xForum'), $displayStrategy, array('onchange' => 'javascript: function loadStrategy(selVal){
$.ajax({
type: "POST",
url: "../mod/xForum/action/displayStrategy.php",
data: { class: selVal }
}).done(function( msg ) {
console.log("Strategy was executed");
});
}; loadStrategy(this.value);') );
That is being executed and the log is printed in the console, but the content in displayStrategy.php is never executed, a "loading" effect is added to the current view and a last problem is I also need to call a function in the same object that is writting the UI ( the one in mod_form.php that executes all the $this -> _form -> addElement(...))
Can you give me a hand? How can I execute those methods according to the strategy?
Thanks a lot!