How to remove get param on form submit? - html

Can you advice me how to remove get parameter (input text) without removing the value of the input or disabling it? Is this possible at all?

Remove the name from the submit input.

The easiest way would be to switch to the POST method when submitting your form. This way the parameters aren't passed by the Url anymore but rather in the HTTP header which is not visible.

You can place the text field outside the form
OR
you could use Javascript and remove that particular parameter before sending the request.
The javascript method will give you more flexibility.

Related

POST more information from HTML page (more than input values)

I am starting web developement.
While POSTing a form, all the input fields are sent as properties (Content-Disposition). I would like to add more information (I mean more properties sent by POST), like a value of some html tag, or the value of an attribut of some div. Is this possible ?
Well an idea to resolve that is to use "hidden input" (#html.HiddenFor). That's what I am going to do waiting for better solution.
What server side technology are you using? You will likely use JavaScript to get other values from your form then submit, but it really just depends. You may want to be more specific.

Retrieve a parameter inside an iframe

I have a jsp which contains a html form. Inside it there is an iframe.
Is there a way to retrieve a parameter that is inside that iframe?
Such situation, you can only use JavaScript to do what you want.
Yes you can via JavaScript.
Here is how I would do that using jQuery (JavaScript library):
$('#someForm iframe').contents().find('input[name=myinputbox]').val();
This selects the iframe from within a form with id="someForm" and then gets the value of an input field with name="myinputbox".
If you have a form inside the iframe, it's handled like every other form and may be sent via a submit-button, which transfers all given parameter.
If you try to access the iframe-contents from the outer html-page(-form), then (as buaastorm already suggested) you may only use JavaScript to do so…

jSP form Query Parameters

While using an HTML form on a jsp page, the data/values automatically get picked up on submit and a url gets generated: nextPage.do?param1=value1&param2=value2
Is there a way to change the generated url without redirecting again: nextPage.do?q={param1=value1$param2=value2}.
Thanks.
Use JavaScript to handle the form submission, extract the parameters, and transform them. But be careful about special characters : what if some parameter value has a dollar sign inside? I wonder why you want to do that.

Clear input values

Data comes from a Servlet to HTML input field in a JSP page. When I press <input type="reset">, the data is not cleared. How can I solve this?
HTML reset buttons do not clear the fields in the form; they reset the fields back to their initial values (see example).
If you want to actually clear the data, you'll need to write a specific server-side controller to do that, or use javascript.

Ways to remove the autocomplete of an input box

I need a text input field which does not use the autocomplete function - If a user has submitted the form before, his previous submissions should -not- appear as he types into the form again, even if he is typing the same thing again. As far as I can tell, there are a few ways to do this:
1. <form autocomplete="off">
However, I believe this is a proprietary tag, and I am not sure how compatible it is across browsers
2. Give the input field a random 'name'
One could even use JS to set the name back to an expected value before submission. However, if the user does not have JS installed, you'd need another hidden input with the name - and the php code on the other side gets messy fast.
Do you know of any other ways? Is one of these ways the "accepted" way? Comments?
Thanks,
Mala
Lookie here: Is there a W3C valid way to disable autocomplete in a HTML form?
Stick with the random name. You can do it simply enough server and client and you meet your no-js requirement.
You can store the original and changed name in a $_SESSION variable before outputting the form, and after the user submits, just get the name from there:
$random_name = md5('original_name' . time());
$_SESSION['original_name'] = $random_name;
...output form...
And after submitting you can easily get the value from $_POST using the $_SESSION variable:
$field_value = $_POST[$_SESSION['original_name']];
Just be sure that you have sessions available by calling session_start() before any processing.
Autocomplete is something that browsers decided to do on their own, so there’s certainly no spec document to look at.