Hi Everyone,
I am the Moodle Admin for an online university and we are using a JavaScript bookmarklet which I programmed to change the settings for each of our course actvities and resources to ensure that the settings are consistent across courses.
For example, I am using the following code to allow access to an activity at the start of a particular unit.
document.getElementsByName("availablefrom[day]")[0].value=defaultStartDay; document.getElementsByName("availablefrom[month]")[0].value=defaultStartMonth; document.getElementsByName("availablefrom[year]")[0].value=defaultStartYear; document.getElementsByName("availablefrom[hour]")[0].value=defaultStartHour; document.getElementsByName("availablefrom[minute]")[0].value=defaultStartMinute;
document.getElementsByName("availablefrom[enabled]")[0].checked=true;
The first five lines set the start date, month, year, hour and minute. The last line of the code sets the checkbox to checked; however, it does not trigger whatever function is normally triggered when clicking on the checkbox manually. This function enables the "availablefrom[]" drop-downs (from their disabled state). If this function is not called, the dropdown information is not sent properly.
Can anyone tell me how to trigger this event, or call the function? I have looked at the code, but it is a bit beyond me.
Thank you in advance...with more thanks to follow! It will be, I assure you, greatly appreciated!
Take care.
Christian