You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Wells <we...@orange.net> on 2003/06/15 13:48:07 UTC

Multibox value always checked

Hi,

I've a problem with using a multibox in that when I uncheck all values and submit my form, the array of selected items is not updated. I've seen this question posted a few times before and the answer always seems to be to perform a reset in the Action class. This sounds like a logical solution but I have a little problem with this due to the architecture we are using. Essentially we are using the Command design pattern with DynaBeans and we only use one generic Action class. As multiple beans are passed through this action class it is not suitable for us to reset the checkboxes here as this means that the Action class becomes specific to the bean that is being submitted.

Is there another way around this problem? The only way I can think of is to use JavaScript to populate a hidden value when all checkboes are unchecked (then use this value later on), but I would really prefer not to use JavaScript.

Many thanks. 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Validator.xml - mask || mask1 || mask2

Posted by ro...@bowtech.com.
Hi All,
Have a set of forms in an app that can be used in multiple countries.  Is there a way that I can validate a field by one of multiple masks?  I.e is the field valid for mask || mask1 || mask2.  Relevant fields will be zip codes and phone numbers.

<?xml version="1.0" encoding="UTF-8"?>

 

<!DOCTYPE form-validation SYSTEM "C:\jakarta-struts-1.1-rc1\lib\validation_1_1.dtd">

<form-validation>

            <formset>

                        <constant>

                                    <constant-name>us-zip</constant-name>

                                    <constant-value>^\d{5}(-\d{4})?$</constant-value>

                        </constant>

                        <constant>

                                    <constant-name>aust-zip</constant-name>

                                    <constant-value>^\d{4}$</constant-value>

                        </constant>

                        <constant>

                                    <constant-name>uk-zip</constant-name>

                                    <constant-value>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$ </constant-value>

                        </constant>

                        <form name="regionalOfficeForm">

                        

                        <!-- want to validate by mask || mask1 || mask2. The code below does mask && mask1 && mask2  (?)  -->

                        

                                    <field property="postalCode" depends="required,mask,mask1,mask2">

                                                <arg0 key="regionalOfficeForm.postalCode"/>

                                                <var>

                                                            <var-name>mask</var-name>

                                                            <var-value>${us-zip)</var-value>

                                                </var>

                                                <var>

                                                            <var-name>mask1</var-name>

                                                            <var-value>${aust-zip)</var-value>

                                                </var>

                                                <var>

                                                            <var-name>mask2</var-name>

                                                            <var-value>${uk-zip)</var-value>

                                                </var>

                                    </field>                                    

                        </form>

            </formset>

</form-validation>

 

 

 

Thanks



Ross