struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Griffith, Michael *" <>
Subject RE: Required field only works with text fields?
Date Mon, 16 Mar 2009 18:18:10 GMT
Ok, So I am being a bone-head.  

When I added the @RequiredStringValidator to the model, the validation
is in sync with what is being required on the form. That makes sense to
me, but... 

How are relationships handled? I have a form control as such:

<s:select key="component.status" name="selectedStatus" required="true"
                               headerValue="-- Select Status --"

And the relationship is being managed via a JPA 
@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
@JoinColumn(name = "STATUS")
public Status getStatus() {
	return status;

What sort of annotation should I use to validate the user selected an
item from the list?

Any reply is appreciated...


-----Original Message-----
From: []
Sent: Friday, March 13, 2009 6:01 PM
To: Struts Users Mailing List
Subject: Re: Required field only works with text fields?

The required attribute only paints the asterisk -- it has nothing to do
with actually "requiring" input.  Nice huh?


On Fri, Mar 13, 2009 at 4:14 PM, Griffith, Michael * <> wrote:

> Hi all,
> I just noticed that the only required field validations that seem to
> be working in my form are text field validations.
> Any HTML tag that renders a list, check box or radio button doesn't
> validate, even though the template shows the field as required.
> In other words, this tag:
> <s:radio key="component.modified" name="modifiedFromSource"
> list="#{'Y':'Yes', 'N':'No'}" required="true" tabindex="7"/>
> Shows a radio button with the "*" required indicator, but the form is
> allowed to be submitted without a button selected, which of course
> breaks my request/response cycle...
> Do I need to do something special to make the required non-text inputs
> to behave as I expect?
> Any help is appreciated.
> Best Regards,
> MG

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message