struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Irwan Nurwandi" <irwan.nurwa...@gmail.com>
Subject Re: pb using validator with struts1.2.9
Date Wed, 26 Jul 2006 12:48:02 GMT
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 <jeremy.jardin@gmail.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message