replace="instance"

Hi,

I'm trying to do the following:

I have 2 select1 fields, one for country (pais), the other for city 
(ciudad).

When the document is loaded requested, I generate a list of countries 
(in an instance), but not of cities.

My idea is to use the xforms-value-changed event on the first select1 so 
that I can get the cities from a database lookup using the submitted 
country ID.

The example is quite simple and it's partially working (on Mozilla+XForms).

The form does get submitted when I select a country and the server app 
returns the updated instance data. I've checked this with Allan 
Beaufour's XForms Buddy.

The problem is that although everything seems fine up to this point, the 
cities select doesn't show the newly received options.

Am I missing something?


Thanks,

Nico.


The xhtml is shown below and finally the server response:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>locacion</title>
    <link href="styles/front.css" rel="stylesheet" type="text/css"/>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

<xf:model xmlns:xf="http://www.w3.org/2002/xforms" id="xml-model">
  <xf:instance>
    <locacion xmlns="">
      <fk_id_pais/>
      <fk_id_ciudad/>
      <direccion/>
    </locacion>
  </xf:instance>

  <xf:submission action="get_options" instance="options_locacion_ciudad" replace="instance" id="get_opt_locacion_ciudad" method="post"/>
  <xf:submission action="store" replace="all" id="submission" method="post"/>

  <xf:instance id="options_locacion_pais">
    <options xmlns="">
      <pais db_id="1">Argentina</pais>
      <pais db_id="2">Uruguay</pais>
      <pais db_id="3">Iran</pais> 
    </options>
  </xf:instance>

  <xf:instance id="options_locacion_ciudad">
    <options xmlns=""/>
  </xf:instance>

</xf:model>

  </head>

  <body>
    locacion
<hr/>
<div class="entity-interface" id="locacion">
  <p>
    <xf:select1 xmlns:xf="http://www.w3.org/2002/xforms" ref="fk_id_pais">
      <xf:label>fk_id_pais</xf:label>
      <xf:itemset nodeset="instance('options_locacion_pais')/pais">
        <xf:label ref="."/>

        <xf:value ref="@db_id"/>
      </xf:itemset>
      <xf:send xmlns:ev="http://www.w3.org/2001/xml-events" ev:event="xforms-value-changed" submission="get_opt_locacion_ciudad"/>
    </xf:select1>
  </p>
  <p>
    <xf:select1 xmlns:xf="http://www.w3.org/2002/xforms" ref="fk_id_ciudad">
      <xf:label>fk_id_ciudad</xf:label>

      <xf:itemset nodeset="instance('options_locacion_ciudad')/ciudad">
        <xf:label ref="."/>
        <xf:value ref="@db_id"/>
      </xf:itemset>

    </xf:select1>
  </p>
  <p>
    <xf:input xmlns:xf="http://www.w3.org/2002/xforms" ref="direccion">

      <xf:label>Direccion</xf:label>
    </xf:input>
  </p>
  <xf:submit xmlns:xf="http://www.w3.org/2002/xforms" model="xml-model" submission="submission">
    <xf:label>Enviar</xf:label>
  </xf:submit>
</div>

  </body>
</html>


The server returns this:

<options xmlns="">
  <ciudad db_id="4">Cordoba</ciudad>
  <ciudad db_id="5">Rosario</ciudad>
</options>

Received on Friday, 10 February 2006 23:37:54 UTC