Re: replace="instance"

I've tried this same example with FormFaces and it doesn't work either
but the error is different.

When I select one value from the first select1 field I get this log:

Dispatching event xforms-recalculate on <span class="xforms-model"/>
Calculated: fk_id_pais.text = "2"
Dispatching event xforms-revalidate on <span class="xforms-model"/>
Revalidated: select
Dispatching event xforms-value-changed on <span class="xforms-select1"/>
Dispatching event xforms-refresh on <span class="xforms-model"/>

Dispatching event xforms-submit on <span class="xforms-submission"/>
Dispatching event xforms-rebuild on <span class="xforms-model"/>
Dispatching event xforms-submit-error on <span class="xforms-submission"/>


The interface gets rebuilt but the first select (pais) has dissapeared
and the second one has empty options.

When I try to see the JavaScript console I get an "Unresponsive Script"
warning message.

you can see this online at:
http://64.191.26.197:8090/show?e=locacion&i=main


Anyone from the FormFaces team has any hints on this one?

TIA,

Nico.


Nicolás Echániz wrote:

 > 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>
 >
 > _______________________________________________
 > dev-tech-xforms mailing list
 > dev-tech-xforms@lists.mozilla.org
 > https://lists.mozilla.org/listinfo/dev-tech-xforms
 >

Received on Saturday, 11 February 2006 07:45:50 UTC