Announcement Announcement Module
Collapse
No announcement yet.
Strange behaviour with binding to Textarea Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strange behaviour with binding to Textarea

    I have a problem regarding spring:bind and 'Textarea'

    I the db (MySQL 4.0.x) the string looks fine, but when I load a textstring throught <spring:bind>-tag, the bind mechanism(??) suddenly inserts blank spaces or tabs before the string, which "puts" the text an annoying distance to the right in the textarea.


    Anybody know why, and what can you do about it?

  • #2
    are you sure it's not the HTML at fault? Textarea content is treated literally, so if your code looks something like:

    Code:
    <textarea>
      $&#123;status.value&#125;
    </textarea>
    then you will see this effect because of the line break and indentation in the source. It needs to be

    Code:
    <textarea>$&#123;status.value&#125;</textarea>

    Comment


    • #3
      Yep!

      That was it.
      You live, you learn.

      Thank you for answering!

      Comment


      • #4
        It maybe a workaround but there's still a bug.

        The following code is taken from the petclinic sample and does NOT work with Spring 1.1 final (no line break included):

        <TEXTAREA rows="10" cols="25" name="description" value="<c:out value="${status.value}"/>" ></TEXTAREA>

        And IMO it shouldn't matter if there's a line break or not...

        Thanks,
        Lars

        Comment


        • #5
          Originally posted by j2ux
          It maybe a workaround but there's still a bug
          The 'bug' is in the petclinic code in that case. The textarea element should not have a value attribute (see http://www.w3.org/TR/html4/interact/forms.html#h-17.7). The value should be specified between the textarea tags.

          I'll take a look at it and fix the samples. Thanks for pointing it out.

          Regards,

          Comment


          • #6
            OK, thanks for pointing that out !

            Comment

            Working...
            X