By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,483 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,483 IT Pros & Developers. It's quick & easy.

input field verses textbox field

P: 57
There must be a difference between a standard input field and a textbox field.
I would like to use a textbox field and save the value in a hidden field for paging. This works in a default input field but not a textbox field.

here is my code

Expand|Select|Wrap|Line Numbers
  1.  
  2. String inputBox = request.getParameter("inputBox");
  3.         if (inputBox == null) {
  4.     inputBox = "";
  5.  
  6. <textarea style="width:200px; height:50px;" id="inputBox" name="inputBox" value=<%=inputBox %>></textarea>
  7.  
  8.  
  9.  
  10. <input type="hidden" name="inputBox"     value="<%= request.getParameter("inputBox") %>">
  11.  
  12.  
  13.  
Jan 10 '08 #1
Share this Question
Share on Google+
9 Replies


acoder
Expert Mod 15k+
P: 16,027
A textarea can span over more than one line.

When you view source, how does it appear?

Is there any JavaScript involved here? If not, I'll move this to the Java forum where you might find some JSP experts.
Jan 11 '08 #2

P: 57
When you view source, how does it appear?

Is there any JavaScript involved here?
Expand|Select|Wrap|Line Numbers
  1. <textarea style="width:200px; height:50px;" id="inputBox" name="inputBox" value=test test test test test tests tests tests></textarea>
  2.  
There is no javascript for this field yet.
Jan 11 '08 #3

acoder
Expert Mod 15k+
P: 16,027
The value attribute value has to be in quotes:
Expand|Select|Wrap|Line Numbers
  1. <textarea style="width:200px; height:50px;" id="inputBox" name="inputBox" value="test test test test test tests tests tests"></textarea>
Jan 11 '08 #4

P: 57
Thanks aCoder. I noticed that after my post too but it didn't change the outcome. The value is now in quotes but is the textbox remains empty.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <textarea style="width:200px; height:50px;" id="inputBox" name="inputBox" value="<%=inputBox%>"></textarea>
  3.  
  4.  
Jan 11 '08 #5

acoder
Expert Mod 15k+
P: 16,027
Sorry, I don't know what I was thinking. The text for the textarea appears between the textarea tags:
Expand|Select|Wrap|Line Numbers
  1. <textarea style="width:200px; height:50px;" id="inputBox" name="inputBox">test test test test test tests tests tests</textarea>
Jan 11 '08 #6

P: 57
I tried wrapping the value with or without quotes and both result in a blank textarea field after submit. The value is on the form but is not being entered into the textarea.

Any other thoughts?
Jan 21 '08 #7

acoder
Expert Mod 15k+
P: 16,027
Forget about the value attribute. The text for the textarea appears between textarea tags unlike input tags.
Jan 21 '08 #8

P: 57
you rock!

solution below.

Expand|Select|Wrap|Line Numbers
  1. <textarea style="width:200px; height:50px;" id="inputBox" name="inputBox"><%=inputBox%></textarea>
  2.  
  3.  
Jan 21 '08 #9

acoder
Expert Mod 15k+
P: 16,027
Glad to hear that you got it working.
Jan 22 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.