- From: Sandeep Moondra <sandeepm@aztec.soft.net>
- Date: Wed, 24 Mar 2004 11:44:04 +0530
- To: www-forms@w3.org
Hello, I am facing a problem when doing a rebuild after modifying the XML in the instance by adding more elements. For some reason, the added elements are not bound properly. Could you please let me know if this is a problem with my approach or a possible bug in the XForms client implementation? I have an XML with one element in it. This element has an attribute of type Boolean. I create bind statements for this to ensure that the client displays a checkbox when rendering the XForm. However, in the bind, I also do a a-priori bind. This is a bind for an attribute in an element which does not exist when the instance gets loaded by the XForms. <xforms:bind id="RotateLine1" type="xsd:boolean" nodeset="xforms:instance('masterInst')/banners/page[@sysid=1]/banner[@sysid= 1]/@rotateDisplay" /> <xforms:bind id="RotateLine2" type="xsd:boolean" nodeset="xforms:instance('masterInst')/banners/page[@sysid=1]/banner[@sysid= 2]/@rotateDisplay The second bind is for an element which does not exist initially, but which will be added later on. Once the instance gets loaded, I add this new element using Jscript and then execute a rebuild. I assume that when I do the rebuild, since the instance now has 2 elements, both the binds specified will get executed. However, this does not seem to be the case. And instead of a checkbox for the second element I see an inputbox in the rendered display. Can someone please comment on the approach? When the rebuild is executed, shouldn't the bind statements be executed all over again and accordingly the display should render a checkbox instead of an input box. I have to modify the XML after it has been loaded by the XForms as there is no way I can modify the XML beforehand due to other system constraints. I am using FormsPlayer version - 1.0.1.1005. Regards, Sandeep Moondra // SAMPLE CODE - ============================================================================ ========== <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en"> <head> <object id="behaviour" classid="CLSID:4D0ABA11-C5F0-4478-991A-375C4B648F58"></object> <?import NAMESPACE="xforms" IMPLEMENTATION="#behaviour" ?> <title>Banners</title> <xforms:model id="mainModel"> <xforms:instance id="masterInst"> <screen> <banners> <page sysid="1"> <banner sysid="1" message="THANK YOU" rotateDisplay="true" /> </page> </banners> </screen> </xforms:instance> <xforms:bind id="Line1" nodeset="xforms:instance('masterInst')/banners/page[@sysid=1]/banner[@sysid= 1]/@message" /> <xforms:bind id="Line2" nodeset="xforms:instance('masterInst')/banners/page[@sysid=1]/banner[@sysid= 2]/@message" /> <xforms:bind id="RotateLine1" type="xsd:boolean" nodeset="xforms:instance('masterInst')/banners/page[@sysid=1]/banner[@sysid= 1]/@rotateDisplay" /> <xforms:bind id="RotateLine2" type="xsd:boolean" nodeset="xforms:instance('masterInst')/banners/page[@sysid=1]/banner[@sysid= 2]/@rotateDisplay" /> </xforms:model> </head> <body bgColor="#ffffff" leftMargin="5" topMargin="0" marginheight="0" marginwidth="0" onLoad="addBanner()"> <script language="JScript"> function addBanner() { var mainModel = document.getElementById("mainModel"); var masterInstance = mainModel.getInstanceDocument("masterInst"); alert("XML BEFORE ADDITION OF NEW BANNER : \n "+ masterInstance.xml) var sampleNode = masterInstance.selectSingleNode("//page"); var newBanner = masterInstance.createElement("banner"); newBanner.setAttribute("sysid","2"); newBanner.setAttribute("message","VISIT AGAIN"); newBanner.setAttribute("rotateDisplay","true"); sampleNode.appendChild(newBanner); alert("XML AFTER ADDITION OF NEW BANNER : \n "+ masterInstance.xml) mainModel.rebuild(); } </script> <table border="0" cellpadding="0" cellspacing="0" width="478"> <tr> <td width="120">Line</td> <td width="120">Message</td> <td width="160">Rotate</td> </tr> <tr> <td>1:</td> <td><xforms:input bind="Line1" /></td> <td><xforms:input bind="RotateLine1" /> </td> </tr> <tr> <td>2:</td> <td><xforms:input bind="Line2" /></td> <td><xforms:input bind="RotateLine2" /></td> </tr> </table> </body> </html> ============================================================================ ==========
Received on Wednesday, 24 March 2004 01:31:09 UTC