I have a form which sends a request to the controller.
<form method="POST" action="/user/{id}">
<input type="text" placeholder="Input Id">
<button>Get User</button>
</form>
I need to add inputed value from to the action of form. How can I do it? For example, if user input '2', my action must be action="/user/2".
UPD:
Can I use somthing like this (see below)?
<form:form id="myForm" method="POST" action="">
<input type="text" id="userId" placeholder="Input Id">
<button onclick="setId()">Get User</button>
</form:form>
And script:
<script>
function setId (){
var id = document.getElementById('userId');
document.getElementById('myForm').action = '/user/'+id;
}
</script>