W3C home > Mailing lists > Public > www-forms@w3.org > May 2009

RE: question about embedded instance vs. ref to an xml file

From: Howard, Chris <HowardC@prpa.org>
Date: Thu, 21 May 2009 16:43:38 -0600
Message-ID: <1305E9F69BC3CE49ABCDC8E00492F7021F2E70@titan.internal.prpa.org>
To: "Howard, Chris" <HowardC@prpa.org>, "Mark Birbeck" <mark.birbeck@webbackplane.com>
Cc: "John Boyer" <boyerj@ca.ibm.com>, <www-forms@w3.org>
I forgot to attache it, sorry.
Anyway, I have boolean elements and text elements.
On xforms-ready I test some elements in the main instance
and set values in the "flagSet" instance.  It doesn't work.
But.. if I move those elements into the main instance
than the setvalue does work.  So I've concluded that my
logical test is ok but that something is funny with
setvalue across instances.
<html xmlns="http://www.w3.org/1999/xhtml"
       <object id="formsPlayer"
            formsPlayer has failed to load! Please check your installation.
 <?import NAMESPACE="xf" IMPLEMENTATION="#formsPlayer" ?>
<title> An XForms Example</title>
<html xmlns="http://www.w3.org/1999/xhtml"
 <xf:instance id="flagSet"
                       <budgetFlag type="xs:boolean"/>
                        <finalFlag type="xs:boolean"/>
 <xf:bind nodeset="/bill/budgetText" id="budgetText"/>
 <xf:bind nodeset="/bill/finalText" id="finalText"/>
 <xf:bind nodeset="instance('flagSet')//budgetFlag" id="budgetFlag" type="xs:boolean"/>
 <xf:bind nodeset="instance('flagSet')//finalFlag" id="finalFlag" type="xs:boolean"/>
        <xf:action ev:event="xforms-ready">
  <xf:setvalue bind="budgetFlag" value="if(/bill/budgetFlag/text() = '1', true(), false())"/>
  <xf:setvalue bind="budgetText" value="if(/bill/budgetFlag/text() = '1','Budget yes', 'not a Budget')"/>
  <xf:setvalue bind="finalFlag" value="if(/bill/finalFlag/text() = '1', true(), false())"/>
  <xf:setvalue bind="finalText" value="if(/bill/finalFlag/text() = '1','Final yes', 'not a Final')"/>

  <xf:input bind="budgetFlag" appearance="minimal" class="flag"><xf:label>budget?</xf:label></xf:input>
  <xf:input bind="finalFlag"  appearance="minimal" class="flag"><xf:label>final?</xf:label></xf:input>
  <xf:input bind="budgetText"><xf:label>budget Text</xf:label></xf:input>
  <xf:input bind="finalText"><xf:label>final Text</xf:label></xf:input>



From: Howard, Chris
Sent: Thu 5/21/2009 4:38 PM
To: Mark Birbeck
Cc: John Boyer; www-forms@w3.org
Subject: RE: question about embedded instance vs. ref to an xml file

Thank you for the pointer to Fiddler.  I installed that today and it has been very helpful.
I also have a sample of my currently broken Xforms code. 
On event xforms-ready it copies data from one in-line instance to another.
I'm not sure if this list allows attachments, but I will attach the code.
In my setvalue element, if the bind clause refers to one instance but the 
value clause refers to elements in the other instance than the setvalue
doesn't seem to work.
If on the other hand both the bind and the value parts refer to elements
in the same instance than it works.


From: Mark Birbeck [mailto:mark.birbeck@webbackplane.com]
Sent: Thu 5/21/2009 1:56 AM
To: Howard, Chris
Cc: John Boyer; www-forms@w3.org
Subject: Re: question about embedded instance vs. ref to an xml file

Hi Chris,

Sorry that I didn't spot this thread earlier so I'm coming late to this.

I see that you've managed to work around this, but if you get the
problem again, send the two versions of your form, and we can take a

John's suggestion sounds the most likely explanation to me, though,
since loading an external document means that it will get its own set
of namespaces that are completely independent of those of the host

Another small point in passing, if you don't use something like
Fiddler, then I would recommend it. The mime type possibility you
mention would then be very quick to spot.


Received on Thursday, 21 May 2009 22:49:14 UTC

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