W3C home > Mailing lists > Public > www-forms@w3.org > February 2006


From: Nicolás Echániz <nico@rakar.com>
Date: Fri, 10 Feb 2006 20:37:09 +0000
Message-ID: <43ECF975.6040506@rakar.com>
To: www-forms@w3.org, dev-tech-xforms@lists.mozilla.org


I'm trying to do the following:

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

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?



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">
    <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">
    <locacion xmlns="">

  <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> 

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



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

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

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

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

  <xf:submit xmlns:xf="http://www.w3.org/2002/xforms" model="xml-model" submission="submission">


The server returns this:

<options xmlns="">
  <ciudad db_id="4">Cordoba</ciudad>
  <ciudad db_id="5">Rosario</ciudad>
Received on Friday, 10 February 2006 23:37:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:16 UTC