This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 1.2 array validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1.2 array validation" Watch "Struts 1.2 array validation" New topic
Author

Struts 1.2 array validation

Varsha Goswami
Greenhorn

Joined: Jul 20, 2009
Posts: 16
Hi,

I had developed an application having a selection box <html:select multiple="true"> with multiple="true" in it as it contains multiple names. Whenever I am selecting a number of names from that selection box then in case of any error, those selection values cannot be retained. But if they are saved successfully then they can be retained.

Attached here are two screenshots:- one in case of selection and other in case of an error.

I need to fix this problem asap.

Please somebody help me....




[Thumbnail for addUser.png]


Varsha
Varsha Goswami
Greenhorn

Joined: Jul 20, 2009
Posts: 16
Another attachment is here... this is the case when an error comes up when I leave all the other mandatory fields as blank and select only the names from selection box.



[Thumbnail for ErrorUser.png]

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

You mean when javascript validations errors occurred, then the select box doesn't show the box selected, well then I say, thats the default behavior of any browser.

If this is not the case, then please explain.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

From second post, I'm confused little bit, if you don't fill the mandatory fields, then there ought to be an error.
Varsha Goswami
Greenhorn

Joined: Jul 20, 2009
Posts: 16
Thanks for your immediate response.

I know error will come for mandatory fields, but the selection list box has values selected in it which is not an error. After error am able to retain all the inserted values in the textboxes or dropdown, but only in case of selection box am not able to retain those values.

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Varsha Goswami wrote:After error am able to retain all the inserted values in the textboxes or dropdown, but only in case of selection box am not able to retain those values.

You have to implement some Javascript code to retain this value, I'm not sure about whether Struts Validations support your requirement.
BTW, which validations you're using, client side or server side ?
Varsha Goswami
Greenhorn

Joined: Jul 20, 2009
Posts: 16
I don't know how to apply Javascript validation on this..Currently, I am using server side validations..
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

I think there is no attribute SELECTED for multiple select tag.
If there any, then you can apply some logic like this, when you show the JSP page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 1.2 array validation