Notice:

Due to a change in my hosting provider's PHP configuration, this tutorial has not been working for a while. I will try to fix this as soon as I can.

<!-- All client-server communication is via the 'controller' --> <div id="controller"/> <!-- form 1: select a company --> <form action="form.php?action=getaddress" b:destination="id('controller')" b:mode="replacechildren"> <!-- Don't do anything fancy on submit, just send the form --> <s:event b:on="submit"> <s:task b:action="send"/> </s:event> <p> <label for="name">Company</label> <select name="name" id="name"> <!-- onchange: if the value is not empty submit the form --> <s:event b:on="change" b:test="@value != ''"> <s:task b:action="trigger" b:event="submit" b:target="ancestor::form[1]"/> </s:event> </select> </p> </form> <!-- form 1: company address data --> <form action="form.php?action=setaddress" b:destination="id('controller')" b:mode="replacechildren"> <s:event b:on="submit"> <s:task b:action="send"/> </s:event> <p> <label for="name2">Company</label> <input name="name" id="name2"/> </p> <p> <label for="street">Street/Number</label> <input name="street" id="street"/> / <input name="number" id="number"/> </p> <p> <label for="zip">Zip/City</label> <input name="zip" id="zip"/> / <input name="city" id="city"/> </p> <p> <label for="country">Country</label> <input name="country" id="country"/> </p> <p> <input type="submit"/> </p> </form> <!-- Can hold debug messages (see bottom of form.php) --> <div id="session"/> <!-- Initialize the form (see form.php case:'init') --> <s:execute> <s:task b:action="load" b:url="form.php?action=init" b:destination="id('controller')" b:mode="replacechildren"/> <s:task b:action="js" b:value="update_selects()"/> </s:execute>