input field verses textbox field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • keydrive
    New Member
    • Oct 2007
    • 57

    input field verses textbox field

    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

    [code=html]

    String inputBox = request.getPara meter("inputBox ");
    if (inputBox == null) {
    inputBox = "";
    }

    <textarea style="width:20 0px; height:50px;" id="inputBox" name="inputBox" value=<%=inputB ox %>></textarea>



    <input type="hidden" name="inputBox" value="<%= request.getPara meter("inputBox ") %>">


    [/code]
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    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.

    Comment

    • keydrive
      New Member
      • Oct 2007
      • 57

      #3
      Originally posted by acoder
      When you view source, how does it appear?

      Is there any JavaScript involved here?
      [code=html]
      <textarea style="width:20 0px; height:50px;" id="inputBox" name="inputBox" value=test test test test test tests tests tests></textarea>
      [/code]

      There is no javascript for this field yet.
      Last edited by acoder; Jan 11 '08, 03:30 PM. Reason: fixed code tag

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        The value attribute value has to be in quotes:
        [code=html]<textarea style="width:20 0px; height:50px;" id="inputBox" name="inputBox" value="test test test test test tests tests tests"></textarea>[/code]

        Comment

        • keydrive
          New Member
          • Oct 2007
          • 57

          #5
          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.

          [code=html]

          <textarea style="width:20 0px; height:50px;" id="inputBox" name="inputBox" value="<%=input Box%>"></textarea>

          [/code]

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Sorry, I don't know what I was thinking. The text for the textarea appears between the textarea tags:[code=html]<textarea style="width:20 0px; height:50px;" id="inputBox" name="inputBox" >test test test test test tests tests tests</textarea>[/code]

            Comment

            • keydrive
              New Member
              • Oct 2007
              • 57

              #7
              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?

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Forget about the value attribute. The text for the textarea appears between textarea tags unlike input tags.

                Comment

                • keydrive
                  New Member
                  • Oct 2007
                  • 57

                  #9
                  you rock!

                  solution below.

                  Code:
                  <textarea style="width:200px; height:50px;" id="inputBox" name="inputBox"><%=inputBox%></textarea>

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    Glad to hear that you got it working.

                    Comment

                    Working...