This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes HTML Hidden value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HTML Hidden value" Watch "HTML Hidden value" New topic
Author

HTML Hidden value

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi

I have 2 HTML pages and I need to pass some values using hidden fields. But don't know how to get that values on the next page. Please assist me
Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66
please say clearly what you are doing
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
I have the hidden on the first page

<input type="hidden" name="a1" value="b1">

On the second page I need the value of a1. How to retrive that.
Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66

how can you are redirecting first html to second one
Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66

Have an id for input field
<input type="hidden" name="a1" id="new" value="b1">

here is the code

<script>
var new = document.getElementById("new").value
window.location="http:/adbcd.com?new="+new;

<script>
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
This is the get method. How about post method ?
Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66

how you are redirecting by post method?

give a code snippet
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
After hitting the submit button

<FORM NAME="CityChoice" METHOD="post" ACTION="ss.html">
Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66

I think ,there is no possibility of getting parameter in post method.

let me know why you are redirect one html to another,Anyhow you don't get dynamic content in htmls,

then what is the use of this,it's worthless,

so you combine both into one,you can do whatever you want using javascript and Dom model
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Post would require you to use a serverside language to get at the data. For clientside only you need to use a get.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML Hidden value
 
Similar Threads
Pass Array from servlet program to JavaScript
Settiing hidden fields & Form Beans
Forms in servlet
struts2-populating disabled input fields after validation
Can session variables be stored in HTML