• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing a string array in var-value

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried google but can't seem to find anything on this.

Is it possible to pass a string array in <var-value>. For example something like this (though this doesn't work).


I want to check if any of the fields I'm passing is filled in. And if so they must all be filled in. I can do seperate checks on each one but then I get mutliple(redundant) error messages, so I'd like to pass the array and loop through it in my validator-rules.xml, therefore only having one standard error message if any of them fail.

Hope this makes sense.

Thanks
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general, if I have validation that is slightly complex I just implement the validate method and write it in Java. Be sure to call super.validate.

The validator framework actually calls get methods on your ActionForm, correct? Maybe you could add a getMailingFields method to your form that returns an empty string if any of the fields are empty and then create a validation rule on mailingFields.

If you are using Dynamic forms, then this may not apply.

- Brent
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic