There are several ways that this can be accomplished.

1. Pure Struts. You can create an Initialization Action which holds you form as the input form. When you change select 1, in the onchange submit the page to the init.do. the page will retain all input values as the form will maintain your entries. The problem is that the page will noticably flicker.

2. Pure _javascript_. Down load all options and used _javascript_ to change out the values. Downside, you have a larger page to download (_javascript_) and you have to download all possible options, many of which you will not need.

3. AJAX. The new kid on the block. The Onchange will run a java mthod which will connect to the server and return the updated options. Check out DWR or equivalent.

I am sure there is a JSF or PHP solution as well but I am not familar enough with those technologies to comment.

All three of these options will use _javascript_ to some extent and if someone has _javascript_ disabled, this will not work.


Inactive hide details for Janek Ziniewicz <[EMAIL PROTECTED]>Janek Ziniewicz <[EMAIL PROTECTED]>


          Janek Ziniewicz <[EMAIL PROTECTED]>

          07/26/2005 05:38 AM

          Please respond to
          "Struts Users Mailing List" <user@struts.apache.org>

To

user@struts.apache.org

cc


Subject

Struts + _javascript_ = dynamic forms

I d like to write a form with, say, 3 dropboxes. Choosing an option in
1. box changes list of available options in other 2 boxes.

[Eg. box #1 can store list of countries and box #2 list of cities in
chosen country, or all cities if no country is chosen.]

It can be done with _javascript_. However, I am looking for your opinion
about Struts-way of doing that task.

--
Pozdrawiam,
Janek Ziniewicz
gg: 902858
irc.freenode.net: #gore, #dub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to