aspose file tools*
The moose likes Struts and the fly likes Struts-Validation For Disabled Fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts-Validation For Disabled Fields" Watch "Struts-Validation For Disabled Fields" New topic
Author

Struts-Validation For Disabled Fields

James Gordon
Ranch Hand

Joined: Aug 09, 2002
Posts: 106
Hi,
There is something which bother me with the Struts Validator - I'm using it for client-side validation (Javascript).
It doesn't seemed to be able to cater well for fields which are disabled, by means of having the property readonly="true" - required fields.
When I check the validation scripts in validation-rules for the "required" rules, it seemed that there is a statement which would setfocus on it. To be exact, it is "focusField.focus();". I believe this statement causes some problem for disabled fields as the focus can't be set.
Any comments?

Thanks in advance.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
That all sounds logical. What's the problem?


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
James Gordon
Ranch Hand

Joined: Aug 09, 2002
Posts: 106
Hi,
Had just found out that disabled fields are not even passed during form submission. That should be the reason as to why the validator is not working well.
Perhaps I should enable it back just before the validation so that everything works fine.

Thanks.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
Whenever I use a disabled field, I put the value in a hidden field as well so that it does get submitted. A dirty hack I guess, but you get used to it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts-Validation For Disabled Fields