Form example

In this example, after selecting the option in the first combo it will load the options in the second combo.

from dajax.core import Dajax
from dajaxice.decorators import dajaxice_register

def updatecombo(request, option):
    dajax = Dajax()
    options = [['Madrid', 'Barcelona', 'Vitoria', 'Burgos'],
               ['Paris', 'Evreux', 'Le Havre', 'Reims'],
               ['London', 'Birmingham', 'Bristol', 'Cardiff']]
    out = []
    for option in options[int(option)]:
        out.append("<option value='#'>%s</option>" % option)

    dajax.assign('#combo2', 'innerHTML', ''.join(out))
    return dajax.json()


<select onchange="Dajaxice.examples.updatecombo(Dajax.process, {'option':this.value})" size="1">
    <option value="0">Select...</option>
    <option value="0">Spain</option>
    <option value="1">France</option>
    <option value="2">United Kingdom</option>
<select id="combo2" onchange="" size="1"></select>