Exploring Javascript Calculations in a Moodle Database Activity

  Рет қаралды 662

Sarah Ashley

Sarah Ashley

Күн бұрын

Пікірлер: 9
@evealsdorf7402
@evealsdorf7402 2 жыл бұрын
Hi Sarah, This was great for what I needed. I was just wondering if you have an example of a subtotal for the javascript. I want to total up all points but where there are different weeks, I would like to subtotal by week.
@SarahAshley_GH
@SarahAshley_GH 2 жыл бұрын
Hello @Eve Alsdorf, Thanks for the feedback, glad it was helpful. I have not encountered a use case for subtotals as yet. Can you share a little more detail on your setup? Are your weeks represented as columns, in which case the subtotals would be at the bottom of each column? Or do you have a single field that specifies the week, in which case we need to do multiple tallies simultaneously to sum up values for each matching week? Final question - is there a set number of weeks that users pick from (5 weeks in a dropdown menu or radio buttons)? Your response will help me design the best associated approach for sub-totaling. Thanks!
@skohaya
@skohaya 3 жыл бұрын
Dear Sarah. Can you upload the preset of the db where you Totaled your columns. You had asked on moodle support technical help. I want to total 10 columns and then create the % OF EACH COLUMN.
@SarahAshley_GH
@SarahAshley_GH 3 жыл бұрын
Hello Suzanne Kohaya, Thanks for your question. Do you mean this post of mine? moodle.org/mod/forum/discuss.php?d=140433#p737826 I am sorry but I no longer work at that institution and do not have a copy of that database activity. But I did share my code that worked...can you follow along from my explanation there? moodle.org/mod/forum/discuss.php?d=140433#p737891 I will try to recreate that activity and will share when it is available, if that helps?
@phlerbert
@phlerbert 3 жыл бұрын
Hi Sarah, that was useful. I wondered if, in theory, we can use JS to change the string on the "Save settings" button to something more appropriate like 'Search'. I tried but it is not working and my JS entered in to the template is not present in the source HTML. Any thoughts on this.
@SarahAshley_GH
@SarahAshley_GH 3 жыл бұрын
Hello! Glad you found this useful! 🙂 Not only in theory can you do this, but in actuality! Which template did you put your code in? The Search options show in the List View, so I put my code in the List Template, in the footer. Make sure to disable the editor. I entered the following after the closing table tag. $(document).ready(function(){ $('#options input.btn.btn-secondary').val("SEARCH"); }); Does this work for you now?
@phlerbert
@phlerbert 3 жыл бұрын
Thanks so much @@SarahAshley_GH for taking the trouble to reply :). Sadly, I learn today that my institution has disabled JavaScript templates, claiming that allowing users to do this presents a serious security risk. I have to admit we're a large University so they cannot have oversight over a large userbase But I'm also surprised that client side scripts could be regarded as dangerous. Aren't browsers heavily sandboxed? Welcome your and Moodle views on this to take back to our IT Services.
@SarahAshley_GH
@SarahAshley_GH 3 жыл бұрын
@@phlerbert Okay, I will not try to fight any JavaScript Wars! 😂 But no worries! I believe that renaming that button to SEARCH is a reasonable change request, and this can be taken care of through the Language Strings. So it will change the name of that button across the whole site, for everybody! No JavaScript needed! Take a look at this annotated screenshot. You can send it to your site administrator for them to make the change for you. Hoping that will be permitted! drive.google.com/file/d/1AB4miR8J6dFGp_sDjPGRF7_GrDJ3OROq/view?usp=sharing Let me know if you have further questions. All the best. 🙂
@phlerbert
@phlerbert 3 жыл бұрын
@@SarahAshley_GH ha ha. I'll have a go.
Moodle Development - The JavaScript Framework
10:17
Mukudu Ltd - Publishing
Рет қаралды 685
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
Moodle - Tricks of the Trade: Using the Database Activity
12:09
Private Submissions Database Activity for Moodle
29:26
Sarah Ashley
Рет қаралды 226
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
Database in Moodle
11:23
Nephila Web
Рет қаралды 1 М.
Database activity in Moodle
6:08
Moodle
Рет қаралды 1,5 М.