I've change my validwhen rule into this : <field property="enterpriseName" depends="validwhen"> <arg0 key="error.inscription.entreprise.nom" /> <msg name= "validwhen" key= "errors.validwhen"/> <var> <var-name>test</var-name> <var-value> (((subscriptionType !=1)AND(*THIS*!=null)) OR (subscriptionType==1)) </var-value> </var> </field>
but it still doesn't work.. On 7/26/06, Jeremy Jardin <[EMAIL PROTECTED]> wrote:
-Irwan, Thank you myuch for your help, but I don't have any problem regarding those show/hide method ! I'm just wondering if the fact of removing some fields in the form could be at the origin of my validation matters ?? On 7/26/06, Irwan Nurwandi <[EMAIL PROTECTED]> wrote: > Dear Jeremy .. > > According to your code below, it seems that for the first time the jsp > page load you're initialiaze the var variable into string "1". So the > three object you've mention before automatically will not visible. > > try this and hope you can learn more .. > > Modify your jsp code > > <% > String val = ""; > if (request.getParameter("subscriptionType") != null) { > val = request.getParameter ("subscriptionType") ; > } > else { > val = "1"; > } > %> > > then create the javascript function ChangeUrl(x). > > <script language="javascript"> > function ChangeUrl(x) { > location.href = "yourActionToDisplayJsp.do?subscriptionType=" + x; > }. > </script> > > on your select tag call this function > > <html:select property="subscriptionType" styleId="inscrit" > styleClass="form" onchange="ChangeUrl(this.value)"> > > you do not need to modify another section of code .. > > hope this help .. > > Regards > > Irwan > > On 7/26/06, Jeremy Jardin < [EMAIL PROTECTED]> wrote: > > hum, > > > > I mean my jsp is built dynamically.. so when my select box is set to > "1", > > my jsp is made with 4 fields. > > But if my select box is set to "2", "3" or "4". my JSP page is made > with 3 > > new fields. > > > > And I think that "hide" means present but not visible.. and "not > display" > > means not present in the page. > > > > I hope you'll understand, I'm sorry for my poor english. > > > > > > SO, have a look at my jsp, it could be more comprehensive: > > > > <html:select property="subscriptionType" > styleId="inscrit" > > styleClass="form" onchange="ChangeUrl(this.form)"> > > <html:option value="1"><bean:message key=" > > inscription.particulier"/></html:option> > > <html:option value="2"><bean:message key=" > > inscription.membre.entreprise"/></html:option> > > <html:option value="3"><bean:message key=" > > inscription.professionnel"/></html:option> > > <html:option value="4"><bean:message key=" > > inscription.elu"/></html:option> > > </html:select></td> > > </tr> > > > > <% String val = new String("1") ; %> > > > > <logic:notEqual name="startSubscriptionForm" > > property="subscriptionType" value="<%=val%>"> > > > > <html:text property="enterpriseName" name="S_ENTREP" > > styleId="nomentreprise" styleClass="form" size="20" value=""/> > > <html:text property="legalRepresentant" name="S_REPRES" > > styleId="representant" styleClass="form" size="20" > > <html:text property="siren" styleId="siren" > name="S_SIREN" > > styleClass="form2" size="10" maxlength="14" value="" /></td> > > > > </logic:notEqual> > > > > I just want those 3 fields (enterpriseName, legalRepresentant and > siren) to > > be required if select box != 1. > > > > > > ?? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- ~ jebmail ~
-- ~ jebmail ~