When user clicks submit on a form, I want to modify the contents of one field and then submit. I've now tried about 20 different ways to do this, but none of them work. I'm able to recognize the submit event, cancel it, and modify the fields, but I'm unable to submit the form again in the same event. My latest attempt was with JQuery:
$("form").submit(function (e) {
e.preventDefault();
var element = document.getElementById("categorySafari");
var selection = element.options[element.selectedIndex].text;
document.getElementById("category").value = selection;
this.submit(); // <-- this doesn't work and nothing I've tried here works
});
preventDefault()if it's clean.$("form").submit();at the last line. This way it's just unable to call the submit function at all.