Hi all,

I have want to validate (client-side using javascript generated by the 
validator framework) if my user has at least selected one checkbox in my 
<html:multibox> form item.

Unfortunatly the javascript generator does not generate the JavaScript 
needed to validate this. 

I read somewhere on the mailinglist archive that this is a known issue 
with struts 1.1. The advice was to upgrade using a nightly build.
I tried to do so, but unfortunatly this does not work with the Tiles 
framework (which I'm also using in my application).

Can somebody tell me how to get this validation work?

Below provided my code:

I have a simple validator form:

public class SimpleForm extends ValidatorForm {
        private String[] selectedItems;
 
        public String[] getSelectedItems() {
                return selectedItems;
        }

        public void setSelectedItems(String[] items) {
                this.selectedItems = items;
        }
}

And the following rule in validation.xml:

<formset>
      <form name="simpleForm">
              <field property="selectedItems"
                     depends="required">

                  <arg0 key="simpleForm.selectedItems"/>
              </field>
      </form>
</formset>

I have the following JSP:

<html:javascript formName="autoForm" onsubmit="return 
validateSimpleForm(this);/>
<html:form action="/test">
<html:multibox property="selectedItems">
        <bean:write name="car" property="id"/>
</html:multibox>
</html:form>

Thanks,

Regards,

Harm de Laat
Informatiefabriek
The Netherlands

Reply via email to