Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.58 KB | None | 0 0
  1. <script>
  2.     'use strict';
  3.  
  4.     function checkValue() {
  5.         let schoolNames = new Set();
  6.         let list = document.getElementById("variants");
  7.         for (let i = 0; i < list.options.length; i++)
  8.            schoolNames.add(list.options[i].value);
  9.        if (!schoolNames.has(document.getElementById('entry_286499743').value)) {
  10.            document.getElementById("message").innerHTML = "Incorrect value";
  11.            return false;
  12.        }
  13.        document.getElementById("message").innerHTML = "";
  14.        return true;
  15.    }
  16.  
  17.    function main() {
  18.        let field = document.getElementById("entry_286499743");
  19.        field.addEventListener('change', checkValue);
  20.    }
  21.  
  22.    window.onload = main;
  23.  
  24. </script>
  25.  
  26. <form action="https://docs.google.com/forms/d/e/1FAIpQLSdEg24X_TORjtj3XdWDHKuGgydtaFcj-jz8BvKx5j3eaOWYQA/formResponse" method="POST" id="ss-form" target="_self" onsubmit="return checkValue()">
  27.     <input type="text" name="entry.286499743" value="" class="ss-q-short" id="entry_286499743" dir="auto" aria-label="Asdf  " title="", list="variants">
  28.     <label type="text" id="message"></label>
  29.     <input type="hidden" name="draftResponse" value="[,,&quot;-1546189611401698003&quot;]
  30.    ">
  31.     <input type="hidden" name="pageHistory" value="0">
  32.     <input type="hidden" name="fbzx" value="-1546189611401698003">
  33.     <input type="submit" name="submit" value="&#1043;&#1086;&#1090;&#1086;&#1074;&#1086;" id="ss-submit">
  34. </form>
  35. <datalist id="variants">
  36.     <option>asdf</option>
  37.     <option>sddasdf</option>
  38.     <option>kjasdf;ljasdf;lk</option>
  39. </datalist>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement