We help IT Professionals succeed at work.

Value getting reset for Textarea after validation

Micheal_Male
Micheal_Male asked
on
Medium Priority
564 Views
Last Modified: 2012-05-07
Hello Experts. This is the first time i have encountered this problem. I have a form where i have couple of textarea and some Text fields with submit button. I am using SimpleFormController with Spring validator.

Everytime a user clicks Submit button i am validating to see if all the required fields have been filled out or not. If not then display the message to the user. Everything is working fine but unfortunately if a user types something in the Textarea and forgot to enter data in one of the textbox and he clicks submit then my value from the textarea is getting reset.

Has anyone else encountered this issue for the Textarea ?. If not then could you point out what am i doing wrong ?
<tr>	
<td align = "left">Enter Notes</td>
<td colspan="3" align = "left">
<spring:bind path="user.notes">
	<TEXTAREA rows="3" cols="30" size="30"
	name='<c:out value="${status.expression}"/>'
	value='<c:out value="${status.value}"/>'>
</TEXTAREA>
	<span><font color="red"><c:out
	value="${status.errorMessage}" />
	</font>
	</span>
</spring:bind>
</td>
</tr>

Open in new window

Comment
Watch Question

Full stack Java developer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Murali. Thanks for your reply. This works when i am retrieving the value from the DB. Unfortunately with the statement you posted neither the validator works for it nor the value comes.
Murali MurugesanFull stack Java developer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Not trying to be mean but Thats very strange. It works all the time for everything else other than the Textarea. I imported spring form tag library :-
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

web.xml :-
<taglib-uri>/spring</taglib-uri>
      <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
      </taglib>

And the validator is still not getting invoked.

<spring:bind path="user.notes">
        <TEXTAREA rows="3" cols="30" size="30"
        name='<c:out value="${status.expression}"/>'>
<c:out value="${status.value}"/>
</TEXTAREA>
</spring:bind>
 <form:errors path="user.notes" cssClass="errorBox" />

Author

Commented:
I tried the way the expert asked and still got the same issues.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.