Results 1 to 6 of 6

Thread: Strange behaviour with binding to Textarea

  1. #1
    Join Date
    Aug 2004
    Location
    Stockholm
    Posts
    466

    Default 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?
    Sincerely,
    /The Cantor

    "Murphy was an optimist"
    (The O'Toole commentary on Murphy's Law)

  2. #2
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    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>
    Darren Davison.
    Public Key: 0xE855B3EA

  3. #3
    Join Date
    Aug 2004
    Location
    Stockholm
    Posts
    466

    Default Yep!

    That was it.
    You live, you learn.

    Thank you for answering!
    Sincerely,
    /The Cantor

    "Murphy was an optimist"
    (The O'Toole commentary on Murphy's Law)

  4. #4
    Join Date
    Aug 2004
    Location
    Southern Germany
    Posts
    30

    Default

    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

  5. #5
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    Quote 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,
    Darren Davison.
    Public Key: 0xE855B3EA

  6. #6
    Join Date
    Aug 2004
    Location
    Southern Germany
    Posts
    30

    Default

    OK, thanks for pointing that out !
    Regards,
    Lars Fischer
    http://j2ux.blogspot.com

Similar Threads

  1. Strange setup bean behaviour with validation
    By Christian in forum Web Flow
    Replies: 4
    Last Post: Jun 20th, 2005, 05:27 PM
  2. Replies: 1
    Last Post: May 4th, 2005, 05:06 AM
  3. Replies: 0
    Last Post: Jan 3rd, 2005, 03:31 AM
  4. Desktop application, strange behaviour
    By innovate in forum Container
    Replies: 2
    Last Post: Sep 24th, 2004, 04:32 AM
  5. Replies: 2
    Last Post: Aug 17th, 2004, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •