• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Struts 1.2 array validation

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....

addUser.png
[Thumbnail for addUser.png]
This is the case when I select the names for the first time
 
Varsha Goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
ErrorUser.png
[Thumbnail for ErrorUser.png]
Errorneous condition
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know how to apply Javascript validation on this..Currently, I am using server side validations..
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
this is supposed to be a surprise, but it smells like a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic