I have a php form and am using jquery to edit the name attribute before the form is submitted. I am passing a variable in the class attribute and then adding that to the name attribute so I can use it again when the form is processed. I’m using the following code to accomplish this. The change to the name attribute is triggered when the submit button is pushed. Once the function is completed I want the form to be submitted without the user needing to take any other action. I’ve tried a number of different ways and have not been able to get the form to submit. Any suggestions?
$('input[name=csvsubmit]').click(function(event) {
event.preventDefault();
$('input').each(function() {
var eachClass = $(this).attr('class');
var eachName = $(this).attr('name');
$(this).attr('name', eachName+'_'+eachClass);
});
$('input[name=csvsubmit]').trigger('submit');
});