• Post Reply Bookmark Topic Watch Topic
  • New Topic

passing disabled values to another page  RSS feed

 
Kingsley Mullers
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
i'm passing disabled values to another page but when trying to retreive these values from the second page, they null. Should i make these readonly instead or there something i'm doing wrong/omitted?
first page has the following code,

<tr><td align="right" width="200"><label class="label">First Name</label></td>
<td><input type="text" name="txtfullname" disabled="disabled" class="ItemEnterable" value="" style="width:167px;" />
</td></tr>
<tr><td align="right" width="200"><label class="label">Surname</label></td>
<td><input type="text" name="txtsurname" disabled="disabled" class="ItemEnterable" value="" style="width:167px;" />
</td></tr>

<tr><td align="right" width="200"><label class="Label">Oracle Number</label></td>
<td><input type="text" name="txtemployeeNo" disabled="disabled" class="ItemEnterable" value="" style="width: 167px" />
</td></tr>

second page has the following code

String fullname =request.getParameter("txtfullname");
String surname =request.getParameter("txtsurname");
String landline =request.getParameter("txtlandline");

when printing out these values on this page i get null values...

thanking you
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disabled mean just that. No submission will occur. If that's not your intention, use readonly rather than disabled.
 
anshul saxena
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , You could use the hidden input variable like this :
<input type = "hidden" name = "xyz" value = "abc">

In the other jsp page where you wish to rcv this value just use this line :


String ppp = request.getParameter("xyz");
 
Mario
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to use readonly but it did't work.

So, if you do want to show the disabled value in the first jsp and to pass the value to the second one, I suggest you to use the "disabled" value in combination with the "hidden" one.

<input type = "disabled" name = "xyz_disabled" value = "abc">
<input type = "hidden" name = "xyz" value = "abc">
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Mario",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mario:
I tried to use readonly but it did't work.


readonly works just fine. If it wasn't working for you then you were doing somwthing else wrong.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!