I have a google script web app with input fields. I would like all of those fields is input required if user want to submit data. Therefore, I used \"required\" attribute and ca
preventDefault
is not called onSubmit
. Hence the form is posted to the sandboxed user iframe inside the web-app.
Call preventDefault
.
e.preventDefault();//modified
Make sure #hora
's val()
is not a date object as date objects are illegal as parameters and cannot be passed from client to server.
I think these two functions should be separated:
function callEvent() {
var cellSelectedValue = $('#cellName').val();
google.script.run.withSuccessHandler(machineOption).machineNameByCell(cellSelectedValue);
var machineNameDropBoxhtml = '';
function machineOption(data) {
try {
for (var i = 0; i < data.machineNameArray.length; i++) {
machineNameDropBoxhtml += '<option value=' + data.machineNameArray[i] + '>' + data.machineNameArray[i] + '</option>';
}
$('#machineName').html(machineNameDropBoxhtml);
$('#machineName').formSelect();
} catch (error) {
alert(error);
}
}
}
Like this:
function callEvent() {
var cellSelectedValue = $('#cellName').val();
google.script.run
.withSuccessHandler(machineOption)
.machineNameByCell(cellSelectedValue);
var machineNameDropBoxhtml = '';
}
function machineOption(data) {
try {
for (var i = 0; i < data.machineNameArray.length; i++) {
machineNameDropBoxhtml += '<option value=' + data.machineNameArray[i] + '>' + data.machineNameArray[i] + '</option>';
}
$('#machineName').html(machineNameDropBoxhtml);
$('#machineName').formSelect();
} catch (error) {
alert(error);
}
}