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"
        xmlns:xf="http://www.w3.org/2002/xforms"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
 xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
       <object id="formsPlayer"
          classid="CLSID:4D0ABA11-C5F0-4478-991A-375C4B648F58">
            formsPlayer has failed to load! Please check your installation.
 </object>
 <?import NAMESPACE="xf" IMPLEMENTATION="#formsPlayer" ?>
<title> An XForms Example</title>
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:xf="http://www.w3.org/2002/xforms"
  <bill>
                       <budgetFlag/>
                       <finalFlag>1</finalFlag>
   <budgetText/>
   <finalText/>
  </bill>
 </xf:instance>
 <xf:instance id="flagSet"
                       xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <flags>
                       <budgetFlag type="xs:boolean"/>
                        <finalFlag type="xs:boolean"/>
  </flags>
 </xf:instance>
 <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:action>

</xf:model>
</head>
<body>
       <hr/>
  <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>
 <hr/>
</body>
</html>

 
 
 
 

________________________________

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

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

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.

Regards,

Mark
Received on Thursday, 21 May 2009 22:49:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:16 GMT