struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Siggelkow <bills...@bellsouth.net>
Subject Re: country state swapping in struts
Date Fri, 09 Jul 2004 17:05:30 GMT
Exsqueezeme?

Jignesh Patel wrote:

> Thanks,
> For information but we are facing one more problem we are able to set
> with java script but while givin form update feature it is not working
> as expected.
> 
> -Jignesh
> On Fri, 2004-07-09 at 09:21, Bill Siggelkow wrote:
> 
>>There are several different ways of handling this ... the easiest is to 
>>just use JavaScript -- you can hard-code JavaScript arrays -- or 
>>generate JavaScript arrays using Struts or JSTL tags -- or you can 
>>retrieve the list of states on the fly by using an onchange listener on 
>>the country field. The latter approach allows the most dynamic ability --
>>The JSP below shows how you could change the options displayed in a 
>>select based on the selection of a radio button.
>>
>><%@ page contentType="text/html;charset=UTF-8" language="java" %>
>><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>><html>
>><head>
>>   <title>Struts – JavaScript Example</title>
>>   <script language="JavaScript">
>>      function getOptions(control) {
>>         form = control.form;
>>         form.action = "SetOptions.do?someProp=";
>>         form.action += control.value;
>>         form.submit();
>>      }
>>    </script>
>></head>
>><body>
>>   <html:form action="ProcessMyForm">
>>       <html:radio property="someProp1" value="val1"
>>                    onclick="getOptions(this);"/> Value 1<br/>
>>       <html:radio property="language" value="val2"
>>                    onclick="getOptions(this);"/> Value 2<br/>
>>       SomeProp2:
>>       <html:select property="someProp2">
>>          <html:optionsCollection property="prop2Values"/>
>>       </html:select>
>>       </p>
>>       <html:submit/>
>>   </html:form>
>></body>
>></html>
>>
>>
>>Jignesh Patel wrote:
>>
>>
>>>Hi All,
>>>In our application when user selects country like USA or Canada in turn
>>>it has to show corresponding country's states.
>>>
>>>Is there any struts example available for the same.
>>>
>>>-Jignesh
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>


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


Mime
View raw message