Hey, I'm trying to trigger a JavaScript function with a button, but it doesn't work.
The only error I managed to figure out from the Chrome JavaScript console is this one :
Uncaught SyntaxError: missing ) after argument list vacAdmin:204
It also seems that the function doesn't get recognized.
Well and this is my function :
function editRecord(idVac, title, location, reference, duration, buisness, task, commencement, interest, contractType, salary, func, requirements, employmenttype, employmentlevel){
var vacform = document.createElement("form");
vacform.setAttribute("name", "form");
vacform.setAttribute("method", "post");
vacform.setAttribute("action", "/vacChangeBox");
var vacancyId = document.createElement("input");
vacancyId.setAttribute("type", "hidden");
vacancyId.setAttribute("name", "vacancyId");
vacancyId.setAttribute("value", idVac);
vacancyId.setAttribute("value", title);
vacancyId.setAttribute("value", location);
vacancyId.setAttribute("value", reference);
vacancyId.setAttribute("value", duration);
vacancyId.setAttribute("value", buisness);
vacancyId.setAttribute("value", task);
vacancyId.setAttribute("value", commencement);
vacancyId.setAttribute("value", interest);
vacancyId.setAttribute("value", contractType);
vacancyId.setAttribute("value", salary);
vacancyId.setAttribute("value", func);
vacancyId.setAttribute("value", requirements);
vacancyId.setAttribute("value", employmenttype);
vacancyId.setAttribute("value", employmentlevel);
vacform.appendChild(vacancyId);
var csrf = document.createElement("input");
csrf.setAttribute("type", "hidden");
csrf.setAttribute("name", "${_csrf.parameterName}");
csrf.setAttribute("value", "${_csrf.token}");
vacform.appendChild(csrf);
document.body.appendChild(vacform);
vacform.submit();
}
The function get triggered by this button :
<td><input data-vacIdEdit="${vac.id}" type="button" name="Bearbeiten" value="Edit" onclick="editRecord(${vac.getId()},${vac.getTitel()},${vac.getLocation()},${vac.getReferenceCode()},${vac.getDuration()},${vac.getBuisnessTravel()},${vac.getTasks()},${vac.getCommencement()},${vac.getInterestGroup()},${vac.getContractType()},${vac.getSalary()},${vac.getFunctionality()},${vac.getRequirements()},${vac.getEmploymentType()},${vac.getEmploymentLevel()});"></td>
Any suggestions what could be wrong ?
Thanks in advance