Hi everyone
I am just finishing of my first module for Moodle 1.9.x and am looking for guidance. I have a working solution to my issue, I am just not sure it is the best solution.
What I have is a new activity that when a user creates it (so code in mod_form.php) there is a field for a unique id for one of my companies courses.
I also have three textares as HTMLeditors on the form to contain variosu RichText descriptions etc
The user can fill in these textareas manually or as I want they can click a button, before they save the activity, that will call a web service (passing the id) which will return all the metadata.
Now my current working solution is to open a new window on the button click, this window makes the WebServices call and then via PHP the values are dumped into JavaScript function called by the page onload. The code is attached obviously no use without all my libs but you get the idea
Now the javascript call to set the textarea is:
window.opener.window.editor_<value1>.setHTML("What I want in the textarea");
Where value1 is the md5 or the textarea name.
So great this works BUT I am tying myself to the HTMLArea code which will be no more in Moodle 2.0, what I am after is ideas to make this work with ANY HTMLEDITOR wrapped textareas.
Any thoughts and guidance are greatly appreciated.
Thanks
Martin Holden