jSP form Query Parameters - html

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.

Related

How to get form data value from html and show on other html page

I am working on a html page with an input bar. How can I get the form data from this page to another html page with a iframe? Because I need to embed the search result from other site but I want to show on my site new page. I just guess should use iframe. But I don't know how to get data and add in page address field.
You have several options here:
1) If your form uses GET method, then all the text data from the form will be passed to next page (which is set up as an "action" attribute of the form) in URL (like www.example.com/?name=John&lastname=Doe). After that, you can extract data from this URL using code from this StackOverflow question and put it inside HTML element using Javascript as well like it is done here
2) Whatever server language you use, you can get query variables from there and put them to the page before sending it to the client. In case of PHP, check this example. NB: don't forget about security.
3) You can temporarily store text in localStorage API of the browser. Simply set the value before submitting the form and then get it on the next page.
iFrame would be inefficient and not needed here.

Way to hide variable value in html

Is there any way that we can hide variable value in html? I dont want user to see the values at any cost.
<input id="defaulterrormessage" type="hidden" th:value="${errorMsg}"></input>
The above code will only hide from web page but if you inspect then you can see the value.
No. Use AJAX to pull values from the server as needed instead of storing them in the HTML (or CSS as generated content values or JS as variables, since all those can be discovered).
Can you provide more information? What are you trying to accomplish? If this is a form and you are assigning values after a submit, I suggest a server side language like php or c#.
If you are doing something with these values on your current page you could also store your values in a session variable or cookie depending on what is needed.
There are two approaches:
1) Make the value accessible by the page, but stored outside the page
eg.
Stored in HTML5 localStorage, accessible via localStorage.getItem(value);
Stored in an external JSON file, accessible via Ajax
Stored in a cookie, accessible via cookie interrogation
etc.
2) Hide the encoded value in plain sight. Decode using javascript
eg.
Encode the value as ASCII
Encode the value as Base64
etc.

Why cant I add a URL as a prefilled Wufoo field entry?

I am trying to write some code that will put the current tabs URL into a wufoo form as a default value in the form hash. The code works fine but the wufoo form doesn't want to cooperate. instead of filling the correct URL (Say https://wufoo.com for example) it drops one of the / characters. This also happens if you skip the code and simply type the URL hash as in the example below:
https://ownthistown.wufoo.com/forms/q1d68ngv1qovy1o/def/&field1=http://wufoo.com
The field would show https:/wufoo.com as the entry. ANyone have any ideas why this is happening?

How can I send information from one html page to another?

I want to create an html page which contains a text box. When I am given input and the Enter key is pressed, I want it to go to another html page and display the typed keyword.
How can I do this?
I think you need to use a server-side scripting language to facilitate the manipulation of the inputted data on the form, so that it gets "saved" and displayed in the other html page. I suggest you try reading about PHP, and then turn to handling information in Web Forms...just a thought!
You can use Javascript for that. Check this Tutorial : How do I pass variables between two pages? (GET method)

How to remove get param on form submit?

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.