vendredi 26 mars 2021

script wont work at least i think its the script

im working with coffee cup form builder and I cant get the scripts to work when i enter them in html mode is it something I'm doing wrong or is it the form builder - after a user selects 2 checkboxes the remainder of the boxes should become unavailable (well that's the ideal scenario) i have listed the html and script I'm using - I hope it helps, thanks robert

<!DOCTYPE HTML>
<html>
  
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="common/js/form_init.js" id="form_init_script"
    data-name="">
    </script>
    <link rel="stylesheet" type="text/css" href="theme/default/css/default.css"
    id="theme" />
    <title>
    </title>
  </head>
  
  <body><style>#docContainer .fb_cond_applied{ display:none; }</style><noscript><style>#docContainer .fb_cond_applied{ display:inline-block; }</style></noscript><form class="fb-toplabel fb-100-item-column selected-object" id="docContainer"
action="" enctype="multipart/form-data" method="POST" novalidate="novalidate"
data-form="preview">
  <div class="fb-form-header" id="fb-form-header1" style="min-height: 0px;">
    <a class="fb-link-logo" id="fb-link-logo1" target="_blank"><img title="Alternative text" class="fb-logo" id="fb-logo1" style="display: none;" alt="Alternative text" src="common/images/image_default.png"/></a>
  </div>
  <div class="section" id="section1">
    <div class="column ui-sortable" id="column1">
      <div class="fb-item fb-three-column fb-100-item-column" id="item1">
        <div class="fb-grouplabel">
          <label id="item1_label_0">Check options</label>
        </div>
        <div class="fb-checkbox">
          <label id="item1_0_label"><input name="checkbox1[]" id="item1_0_checkbox" type="checkbox" data-hint="" value="Check 1" /><span class="fb-fieldlabel" id="item1_0_span">Check 1</span></label>
          <label id="item1_1_label"><input name="checkbox1[]" id="item1_1_checkbox" type="checkbox" value="Check 2" /><span class="fb-fieldlabel" id="item1_1_span">Check 2</span></label>
          <label id="item1_2_label"><input name="checkbox1[]" id="item1_2_checkbox" type="checkbox" value="Check 3" /><span class="fb-fieldlabel" id="item1_2_span">Check 3</span></label>
        </div>
      </div>
      <div class="fb-item fb-100-item-column" id="item2">
        <div class="fb-html">
          <div id="item2_div_0">
            <script>var checks = document.querySelectorAll(".check");
var max = 1;
for (var i = 0; i < checks.length; i++)
  checks[i].onclick = selectiveCheck;
function selectiveCheck (event) {
  var checkedChecks = document.querySelectorAll(".check:checked");
  if (checkedChecks.length >= max + 1)
    return false;
}</script>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="fb-captcha fb-item-alignment-center" id="fb-captcha_control"
  style="display: none; cursor: default;">
    <img src="editordata/images/recaptcharecaptchav2-light.png" />
  </div>
  <div class="fb-item-alignment-left fb-footer" id="fb-submit-button-div"
  style="min-height: 0px;">
    <input class="fb-button-special" id="fb-submit-button" type="submit" data-regular="url('file:///C:/Users/Robert/AppData/Local/Temp/FormBuilder/theme/default/images/btn_submit.png')"
    value="Submit" />
  </div>
</form>
</body>



Aucun commentaire:

Enregistrer un commentaire