I have a project based in Spring Web model-view-controller (MVC) framework. The version of the Spring Web model-view-controller (MVC) framework is 3.2.8. and I want to change the form action on a submit button. So here is my code but does not change anything at all !
<script type="text/javascript">
$('#awardProductsButton').click(function(){
$('#devicesFormId').attr('action', 'test');
});
</script>
<form:form commandName="devicesForm" name="devicesForm" id="devicesFormId" method="post"
action="${contextPath}/newdesign/manage/devices/${devicesForm.devices.id" htmlEscape="yes" enctype="multipart/form-data">
<button id="awardProductsButton" class="btn btn-primary" type="submit">AWARD product/s</button>
</form:form>
I also tried
$('#awardProductsButtonId').submit(function(event){
alert ('test');
event.preventDefault();
$('#deviceFormId').attr('action', '${contextPath}/newdesign/manage/device/${deviceForm.device.id}');
});
but even the alert does not show up