I'm not sure if the validators can be applied to collections.
You can validate it yourself:
- either implement Validateable in your action and check the property
in the corresponding method; or
- check the collection in your execute method and return "input" if its
invalid
If you action extends ActionSupport you can raise a field error directly
from your action using addFieldError or addActionError.
Prashant Khanal wrote:
Hello Jeromy,
I do have getters for this property as well.
I am not been able to find a way out on this.
I have to check whether or not the selected list is empty.
I could not get any hints from the mailing list archive too.
On 2/15/08, Jeromy Evans <[EMAIL PROTECTED]> wrote:
Prashant Khanal wrote:
@RequiredFieldValidator(key="sequence.selectedLevelsNotEmpty",
message =
"one or more levels must be selected")
public void setSelectedLevels(List<Long> selectedLevels) {
this.selectedLevels = selectedLevels;
}
As i have to validate the right select element of the
optiontransferselect
so i used the setter property of the selectedLevels.
Hope i am missing something as upon submit no validation error is
thrown.
Try including a getter for this property as well. Validation is
performed on the action instance so it will need to call
getSelectedLevel() to validate this property
I also can't recall whether these validators work on collections or not.
regards,
Jeromy Evans
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.20.5/1279 - Release Date: 14/02/2008 6:35 PM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]