Appending form input value to action url as path
You can use onsubmit
and use jQuery
to obtain the same result.
Check the following.
HTML Code:
<form id = "your_form" onsubmit="yourFunction()">
<input type="text" name="keywords">
<input type="submit" value="Search">
</form>
jQuery Code:
function yourFunction(){
var action_src = $("keywords").val();
var your_form = $('your_form').val();
var urlLink = "http://localhost/test/";
urlLink = urlLink + action_src;
your_form.action = urlLink;
}
You can use onsubmit
attribute and set the action inside a function for example:
<form id="your_form" onsubmit="yourFunction()">
<input type="text" name="keywords">
<input type="submit" value="Search">
</form>
function yourFunction(){
var action_src = "http://localhost/test/" + document.getElementsByName("keywords")[0].value;
var your_form = document.getElementById('your_form');
your_form.action = action_src ;
}