Jump to content

pconkie

Frog Community Genius
  • Posts

    598
  • Joined

  • Last visited

Community Answers

  1. pconkie's post in Urgent: frog forms and options was marked as the answer   
    Since we are nominated for a sharing award...
    Here is our options form not letting students pick the same subject more than once

    2021-02-16 14-37-29.mp4 And here is the code that does it:
    <style> a.disabled { pointer-events: none; cursor: default; background-color:#999 !important; } </style> <script> var $form; var that = this; var values = []; setTimeout(function() { var $site = that.element.closest(".sites-site-content"); $form = $site.find("div[data-name='Widget.Forms']"); $form.off("select"); $form.off("input[type=radio]"); $form.on("change", "select", function() { addAlltoArr(); checkArr(); }); $form.on("change", "input[type=radio]", function() { addAlltoArr(); checkArr(); }); }, 2000); function addAlltoArr() { values = []; $form.find("select").each(function() { if (this.value != "") { values.push(this.value); } }); var selected = $form.find("input[type='radio']:checked"); if (selected.length > 0) { selected.each(function() { values.push($(this).val()); }); } } function checkArr() { if (hasDuplicates(values)) { alert("You have chosen the same subject twice.\nYou will not be able to save your choices until you fix this.") $form.find("#submit_form").addClass("disabled"); } else { $form.find("#submit_form").removeClass("disabled"); } } function hasDuplicates(array) { var valuesSoFar = Object.create(null); for (var i = 0; i < array.length; ++i) { var value = array[i]; if (value in valuesSoFar) { return true; } valuesSoFar[value] = true; } return false; } </script>  
  2. pconkie's post in Emailing classes? was marked as the answer   
    email.html
     
    Hi @johnmorris01
    This little widget should do what you want....

    Instructions for set up
    1. create a new site and drag a html widget onto the page
    2. copy and paste the attached code, then save the site.email.html
     
    Instructions for use
    1. Search for a class in the first box. Just type a few letters of the class name and a list to choose from should appear
    2. Select a class and the member of that class will appear - all will be selected by default
    3. Un-select any students you do not want to email by clicking on them
    4, Press the "copy" button and the email address list will be copied to your clipboard.  A member of staff would then need to open a new gmail message and paste (or ctrl+p) the address list into the send to field.
    If clipboard access is not supported by the browser, a box will appear containing the email address list.  This can be copied in the more conventional way and then pasted later.
    Hope it helps!
    Paul
     
×
×
  • Create New...