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"
tabindex="12"
                               headerKey="-1"
                               headerValue="-- Select Status --"
                               list="statusList"
                               listKey="id"
                               value="%{status.id}"
                               listValue="description"/>

And the relationship is being managed via a JPA 
@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
fetch=FetchType.EAGER)
@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...

MG


-----Original Message-----
From: stanl...@gmail.com [mailto:stanl...@gmail.com]
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?

Peace,
Scott

On Fri, Mar 13, 2009 at 4:14 PM, Griffith, Michael * <
michael.griff...@fda.hhs.gov> 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: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to