How do I get the ID from a checked checkbox? I need to get the selected checkboxes values added into a Google Spreadsheets Cell after pressing submit.
<script>
function sendForm() {
var checkedid = I WOULD NEED THE ID HERE?;
var data = document.forms['form'].elements[checkedid].value;
google.script.run.withSuccessHandler(ready).processForm(data);
document.getElementById("all").innerHTML = "Processing..";
}
function ready() {
document.getElementById("all").innerHTML = "Selected Gear Added!";
google.script.run.showDialog();
}
</script>
<div id="all">
<form id="form">
<input class="checkboxclass" type="checkbox" id="id_1" value="Sony FS5 - SET 1">Sony FS5 - SET 1<br>
<input class="checkboxclass" type="checkbox" id="id_2" value="Sony FS5 - SET 2">Sony FS5 - SET 1<br>
<input class="checkboxclass" type="checkbox" id="id_3" value="Tripod">Tripod<br>
<input class="checkboxclass" type="checkbox" id="id_4" value="Monopod">Monopod<br>
<input class="checkboxclass" type="checkbox" id="id_5" value="Wireless pack - SET 1">Wireless pack - SET 1<br>
<input class="checkboxclass" type="checkbox" id="id_6" value="Wireless pack - SET 2">Wireless pack - SET 2<br>
<input class="checkboxclass" type="checkbox" id="id_7" value="Wireless pack - SONY">Wireless pack - SONY<br>
</form>
<br><br>
<button onclick="javascript:sendForm();">Submit</button>
</div>
Thanks for your help.
Aucun commentaire:
Enregistrer un commentaire