unable to get values in textarea using el

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhuriks
    New Member
    • Jun 2010
    • 149

    #1

    unable to get values in textarea using el

    hi,
    i developed jsp page..in it i need to modify the elements ..for that i used beans to store already existing values and if i call the jsp page by using EL it should take the existing values and do modifications.. .im getting for textboxes but im not getting for textarea ..can any one suggest me how to do..here is my code...

    modify.jsp

    Code:
    <td></td>
    <td><font color="#800000" size=""><b>A-Success Message</b></font></td>
    <td><textarea name="actSuccessMsg" rows="1" value="${packDetails.packDetails.packMessage.actSucessMessage}"></textarea></td>
    <td></td>
    <td><font color="#800000" size=""><b>D-Success Message</b></font></td>
    <td><textarea name="deactSuccessMsg" rows="1" value="${packDetails.packDetails.packMessage.deactSucessMessage}"></textarea></td>
    <td></td>
    thanks in advance..waitin g for the reply,
    madhu
    Last edited by Dormilich; Jul 23 '10, 05:40 AM.
  • madhuriks
    New Member
    • Jun 2010
    • 149

    #2
    can anyone provide me the solution

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Does this have anything to do with JavaScript? Looks like a JSP problem.

      Comment

      • madhuriks
        New Member
        • Jun 2010
        • 149

        #4
        yes ..it will validate..if the textarea left blank it should throws an alert...its a jsp page and im using EL in it to get previous values...can u suggest me what to do to take the values..

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          How are you currently trying to get the value of the textarea?

          Comment

          • madhuriks
            New Member
            • Jun 2010
            • 149

            #6
            already the existing values im taking...for that i used beans..

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              I meant with JavaScript.

              Comment

              • madhuriks
                New Member
                • Jun 2010
                • 149

                #8
                no not by javascript..in java 'Beans' concept is there that i used..

                Comment

                • chaarmann
                  Recognized Expert Contributor
                  • Nov 2007
                  • 785

                  #9
                  In opposite to textboxes, Textareas don't have a value=... property. So your packDetails...-method (whatever that is and whatever this does) will have no effect.
                  This is the way how you assign a value to a text field:
                  Code:
                  <input type=text value="This is my text">
                  This is the way how you assign a value to a text box:
                  Code:
                  <textarea> This is my text </textarea>
                  This is truly a HTML/Javascript question, but not a java question, and should be moved to the appropriate forum.

                  By the way:
                  If you want to assign a value to a textarea in javascript, you can do it with
                  Code:
                  this.innerText="This is my text"

                  Comment

                  • madhuriks
                    New Member
                    • Jun 2010
                    • 149

                    #10
                    hi chaarman,
                    thanks for your reply..i got it what ur saying...then tell me how to get the values in textarea that already present in that field....becaus e in my modify page im displaying already existing values....so i need that is there any other way to get the values..i used Expression Language for getting the values...can u help me out in this issue..

                    Comment

                    • chaarmann
                      Recognized Expert Contributor
                      • Nov 2007
                      • 785

                      #11
                      Originally posted by madhuriks
                      hi chaarman,
                      thanks for your reply..i got it what ur saying...then tell me how to get the values in textarea that already present in that field....becaus e in my modify page im displaying already existing values....so i need that is there any other way to get the values..i used Expression Language for getting the values...can u help me out in this issue..
                      You can get it the same way you set it: with textAreaElement .innerText();

                      example:
                      Code:
                      <textarea onClick="alert(this.innerText)">
                      This is my text
                      </textarea>
                      If you click anywhere inside the text, it grabs the text from the text field and displays it in an alert box

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        Rather than innerText, use innerHTML (or standard equivalent).

                        Comment

                        • madhuriks
                          New Member
                          • Jun 2010
                          • 149

                          #13
                          hi gud mrng,
                          thanks for your reply..i implemented it and i got it...

                          Comment

                          • Dormilich
                            Recognized Expert Expert
                            • Aug 2008
                            • 8694

                            #14
                            In opposite to textboxes, Textareas don't have a value=... property.
                            To explain that a little more.

                            <textarea> does not have the HTML attribute value, but it has (like any form element) the JavaScript .value property. thus you can read/write like any other form element.

                            Comment

                            Working...