So, you need to be able to change the value of the form's action attribute.
<div class="form-group">
<form action="/edit/[[number]]" method="get" id="form">
<input class="form-control" type="text" name="number">
<br>
<input type="submit" name="save" value="save" class="btn btn-success">
</form>
</div>
So, first, we need to give it an id, in this case form
.
Then we need can use jquery to change the value of the action, like this;
$('form#form').attr('action', '/edit/' + $('form#form input[name="number"]').val());
But this only changes the form value once, so we need to add an event listener, in this case, onchange
.
$( 'form#form input[name="number"]').on('input', function() {});
Adding both of them together should create something like this;
$( 'form#form input[name="number"]').on('input', function() {
$('form#form').attr('action', '/edit/' + $('form#form input[name="number"]').val());
});
$( 'form#form input[name="number"]').on('input', function() {
$('form#form').attr('action', '/edit/' + $('form#form input[name="number"]').val());
console.log($('form#form').attr('action'));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="form-group">
<form action="/edit/[[number]]" method="get" id="form">
<input class="form-control" type="text" name="number">
<br>
<input type="submit" name="save" value="save" class="btn btn-success">
</form>
</div>