I have a situation where I want my model to contain different fields
based on a selection made by the user. Since xforms:copy isn't available, I'm trying to use delete+insert -- but I'm having difficulty getting the behavior I expect. In the attached example, when selecting "Toaster" from the dropdown menu, I expect to receive a message box with the text "toaster", followed by a message box with the text "Yaay, toast!" (followed by the contents of instance('appliance-templates-instance')/Appliance[@type='toaster'] replacing any Appliance already in /Document/CustomerSelection/Appliance). Instead, the initial message box provides the text "toaster" (which I take to mean that "." resolves to what I expect it to, CustomerSelection/@appliance_type), but the second message box contains the text "No selection", and the blank template (corresponding with the "No selection" text) replaces the current Appliance. I don't understand this: if "." is "toaster", and instance('appliance-templates-instance')/Appliance[@type='toaster']/@message is "Yaaay, toast!", why would instance('appliance-templates-instance')/Appliance[@type=.]/@message be different? Thank you! -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws silly-contrieved-xforms-example.xhtml (4K) Download Attachment |
Duff,
I was able to get a dropdown working. However, I'm not using the message box. Here is the link to try it - http://128.148.7.210:8080/ops/test/. You select from the drop down and it deletes, inserts... Below is the code: <?xml version="1.0" encoding="utf-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mods="http://www.loc.gov/mods/v3"> <head> <title>Test MODS</title> <xforms:model> <xforms:instance id="main"> <mods:mods xmlns="http://www.loc.gov/mods/v3"> <mods:originInfo> <mods:publisher/> </mods:originInfo> </mods:mods> </xforms:instance> <!--xforms:instance id="selectDateType"> <types xmlns=""> <type name=""></type> <type name="publication">Publication Date</type> <type name="manuscript">Manuscript Date</type> <type name="copyright">copyright Date</type> </types> </xforms:instance--> <xforms:instance id="originInfo-keyDate-template"> <keyDates xmlns=""> <date name="publication"> <mods:dateIssued encoding="w3cdtf" keyDate="yes" point="start"/> </date> <date name="manuscript"> <mods:dateCreated encoding="w3cdtf" keyDate="yes" point="start"/> </date> <date name="copyright"> <mods:copyrightDate encoding="w3cdtf" keyDate="yes" point="start"/> </date> </keyDates> </xforms:instance> <xforms:instance id="keyDate-instance"> <date xmlns=""> <keyDate/> </date> </xforms:instance> </xforms:model> </head> <body> <xforms:group ref="instance('main')/mods:originInfo"> <fieldset> <legend><strong>Main OriginInfo</strong></legend> <xforms:select1 ref="instance('keyDate-instance')/keyDate"> <xforms:label> Date </xforms:label> <xforms:itemset nodeset="instance('originInfo-keyDate-template')/date"> <xforms:label ref="@name"/> <xforms:value ref="@name"/> </xforms:itemset> <xforms:action ev:event="xforms-value-changed"> <xforms:delete nodeset="instance('main')/mods:originInfo/*[contains(name(),'ate')]" at="1"/> <xforms:insert context="instance('main')/mods:originInfo" nodeset="instance('main')/mods:originInfo/child::*" at="last()" position="after" origin="instance('originInfo-keyDate-template')/date[@name = instance('keyDate-instance')/keyDate]/child::*"/> </xforms:action> </xforms:select1> </fieldset> </xforms:group> <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" /> </body> </html> -----Original Message----- From: Duff [mailto:[hidden email]] Sent: Monday, September 17, 2007 6:11 PM To: [hidden email] Subject: [ops-users] Using delete+insert in place of xforms:copy I have a situation where I want my model to contain different fields based on a selection made by the user. Since xforms:copy isn't available, I'm trying to use delete+insert -- but I'm having difficulty getting the behavior I expect. In the attached example, when selecting "Toaster" from the dropdown menu, I expect to receive a message box with the text "toaster", followed by a message box with the text "Yaay, toast!" (followed by the contents of instance('appliance-templates-instance')/Appliance[@type='toaster'] replacing any Appliance already in /Document/CustomerSelection/Appliance). Instead, the initial message box provides the text "toaster" (which I take to mean that "." resolves to what I expect it to, CustomerSelection/@appliance_type), but the second message box contains the text "No selection", and the blank template (corresponding with the "No selection" text) replaces the current Appliance. I don't understand this: if "." is "toaster", and instance('appliance-templates-instance')/Appliance[@type='toaster']/@mes sage is "Yaaay, toast!", why would instance('appliance-templates-instance')/Appliance[@type=.]/@message be different? Thank you! -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |