Is there any way to create a custom event (or something) that will fire after the xform-ready event from within the body of the document? I tried implementing the example from the XForms Sandbox Test Samples custom-events but it did not fire the event from within the <body><repeat><select1/></repeat></body> element of the XForms document. I want to initialize the <select1/> bound element value with the first items value before a user makes a selection. Should it work from within the <select1/> element or no? The code did work when implemented in the <model/> element like the example. -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Martin,
Can you provide an example of what you tried? -Erik On Thu, Dec 10, 2009 at 4:06 PM, Schwartzman, Martin <[hidden email]> wrote: > Is there any way to create a custom event (or something) that will fire > after the xform-ready event from within the body of the document? I tried > implementing the example from the XForms Sandbox Test Samples custom-events > but it did not fire the event from within the > <body><repeat><select1/></repeat></body> element of the XForms document. I > want to initialize the <select1/> bound element value with the first items > value before a user makes a selection. Should it work from within the > <select1/> element or no? The code did work when implemented in the <model/> > element like the example. > > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Erik,
I've tried a couple of things but below is the latest. I tried using xforms-enabled which seems to work under some circumstances (a form with no db access). The xforms-value-changed always works. Is there a way to initialize the select1 and or select values so that if a user does takes the default (does not click on the field) the instance values will always contain a value? The companyStatus select1 below get its data from an MS SQL Sever xpl database query (on submission action xforms-ready). <xforms:select1 ref="companyStatus"> <xforms:label class="fieldLabel">Company Status</xforms:label> <xforms:itemset nodeset="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-ins tance')/row" model="valueListLK-addFilesystem-companyStatus-7-model"> <xforms:label class="fieldLabel" ref="label"/> <xforms:value ref="value"/> </xforms:itemset> <xforms:alert>This field is required</xforms:alert> <xforms:hint/> <xforms:action ev:event="xforms-value-changed"> <xxforms:variable name="theValue" select="xxforms:instance('addServers-instance')/addFilesystem[xxforms:in dex('addFilesystem-repeat')]/companyStatus"/> <xforms:setvalue ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:index ('addFilesystem-repeat')]/companyStatus/@label" value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-insta nce')/row[contains(.//value, $theValue)]/label"/> </xforms:action> <!-- persist initial dropdown values both label and value --> <xforms:action ev:event="xforms-enabled"> <xxforms:variable name="theValue" select="xxforms:instance('addServers-instance')/addFilesystem[xxforms:in dex('addFilesystem-repeat')]/companyStatus"/> <xforms:setvalue ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:index ('addFilesystem-repeat')]/companyStatus/@label" value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-insta nce')/row[contains(.//value, $theValue)]/label"/> <xforms:setvalue ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:index ('addFilesystem-repeat')]/companyStatus" value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-insta nce')/row[contains(.//value, $theValue)]/value"/> </xforms:action> </xforms:select1> Thanks. Martin -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik Bruchez Sent: Thursday, December 10, 2009 8:16 PM To: [hidden email] Subject: [ops-users] Re: Is there any way to create a custom event (or something) that will fire after the xform-ready event. Martin, Can you provide an example of what you tried? -Erik On Thu, Dec 10, 2009 at 4:06 PM, Schwartzman, Martin <[hidden email]> wrote: > Is there any way to create a custom event (or something) that will > fire after the xform-ready event from within the body of the document? > I tried implementing the example from the XForms Sandbox Test Samples > custom-events but it did not fire the event from within the > <body><repeat><select1/></repeat></body> element of the XForms > document. I want to initialize the <select1/> bound element value with > the first items value before a user makes a selection. Should it work > from within the <select1/> element or no? The code did work when > implemented in the <model/> element like the example. > > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Martin,
Since this is not a stand-alone example, we can't run it here and modify it to do the right thing. But it looks to me like you need to set the value of companyStatus to the "default value" if empty, maybe after the call to the XPL that returns the instance that contains companyStatus. I hope this helps; otherwise, could you provide a stand-alone, minimal example, that runs in the XForms sandbox and that shows this issue? Alex On Saturday, December 12, 2009, Schwartzman, Martin <[hidden email]> wrote: > Erik, > > I've tried a couple of things but below is the latest. I tried using > xforms-enabled which seems to work under some circumstances (a form with > no db access). The xforms-value-changed always works. Is there a way to > initialize the select1 and or select values so that if a user does takes > the default (does not click on the field) the instance values will > always contain a value? > > The companyStatus select1 below get its data from an MS SQL Sever xpl > database query (on submission action xforms-ready). > <xforms:select1 ref="companyStatus"> > <xforms:label class="fieldLabel">Company Status</xforms:label> > <xforms:itemset > nodeset="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-ins > tance')/row" model="valueListLK-addFilesystem-companyStatus-7-model"> > <xforms:label class="fieldLabel" ref="label"/> > <xforms:value ref="value"/> > </xforms:itemset> > <xforms:alert>This field is required</xforms:alert> > <xforms:hint/> > > <xforms:action ev:event="xforms-value-changed"> > <xxforms:variable name="theValue" > select="xxforms:instance('addServers-instance')/addFilesystem[xxforms:in > dex('addFilesystem-repeat')]/companyStatus"/> > <xforms:setvalue > ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:index > ('addFilesystem-repeat')]/companyStatus/@label" > value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-insta > nce')/row[contains(.//value, $theValue)]/label"/> > </xforms:action> > > <!-- persist initial dropdown values both label and value --> > <xforms:action ev:event="xforms-enabled"> > <xxforms:variable name="theValue" > select="xxforms:instance('addServers-instance')/addFilesystem[xxforms:in > dex('addFilesystem-repeat')]/companyStatus"/> > <xforms:setvalue > ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:index > ('addFilesystem-repeat')]/companyStatus/@label" > value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-insta > nce')/row[contains(.//value, $theValue)]/label"/> > <xforms:setvalue > ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:index > ('addFilesystem-repeat')]/companyStatus" > value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-insta > nce')/row[contains(.//value, $theValue)]/value"/> > </xforms:action> > </xforms:select1> > > Thanks. > > Martin > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik > Bruchez > Sent: Thursday, December 10, 2009 8:16 PM > To: [hidden email] > Subject: [ops-users] Re: Is there any way to create a custom event (or > something) that will fire after the xform-ready event. > > Martin, > > Can you provide an example of what you tried? > > -Erik > > On Thu, Dec 10, 2009 at 4:06 PM, Schwartzman, Martin > <[hidden email]> wrote: >> Is there any way to create a custom event (or something) that will >> fire after the xform-ready event from within the body of the document? > >> I tried implementing the example from the XForms Sandbox Test Samples >> custom-events but it did not fire the event from within the >> <body><repeat><select1/></repeat></body> element of the XForms >> document. I want to initialize the <select1/> bound element value with > >> the first items value before a user makes a selection. Should it work >> from within the <select1/> element or no? The code did work when >> implemented in the <model/> element like the example. >> >> >> >> -- >> 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 >> OW2 mailing lists service home page: http://www.ow2.org/wws >> >> > Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex,
I am trying to set companyStatus to the default value after the XPL (call to our MS SQL Server database) returns but that's what I can't figure out. It works using the xforms-enabled event but only if select1 items are constructed from an instance in the model. If the select1 items are retrieved from our SQL Sever database trying to set the default value in the companyStatus element via xforms-enabled event does not work. I've attached a slightly different view.xhtlm example. It's complete except for the XPL file (I'm not sure if you need that or not). In this example I retrieve "1 week" through "9 week" from the DB. The first section were the serverOperatingSystem is set via xforms-enabled event works but the second section where the weeks are set does not. In the XML below (after submission) you can see that weeks attribute value label has not been set nor has the week element value, however, serverOperatingSystem has been set. <addServer-main> <addFilesystem sectionLabel="Add Filesystem"> <weeks label="" fieldLabel="Weeks:"/> </addFilesystem> <addServer sectionLabel="Add Server Header"> <serverOperatingSystem label="Windows" fieldLabel="Operating System:">Windows</serverOperatingSystem> </addServer> </addServer-main> In the XML below I clicked on the select1 control and picked "2 week". This actions fired the xforms-value-changed event which ran the xforms:setvalue commands correctly (as programmed) that set the label attribute and element value. <addServer-main> <addFilesystem sectionLabel="Add Filesystem"> <weeks label="2 week" fieldLabel="Weeks:">2</weeks> </addFilesystem> <addServer sectionLabel="Add Server Header"> <serverOperatingSystem label="Unix" fieldLabel="Operating System:">Unix</serverOperatingSystem> </addServer> </addServer-main> Thanks again for your help. Martin -----Original Message----- From: Alessandro Vernet [mailto:[hidden email]] Sent: Saturday, December 12, 2009 8:38 PM To: [hidden email] Subject: [ops-users] Re: Is there any way to create a custom event (or something) that will fire after the xform-ready event. Martin, Since this is not a stand-alone example, we can't run it here and modify it to do the right thing. But it looks to me like you need to set the value of companyStatus to the "default value" if empty, maybe after the call to the XPL that returns the instance that contains companyStatus. I hope this helps; otherwise, could you provide a stand-alone, minimal example, that runs in the XForms sandbox and that shows this issue? Alex On Saturday, December 12, 2009, Schwartzman, Martin <[hidden email]> wrote: > Erik, > > I've tried a couple of things but below is the latest. I tried using > xforms-enabled which seems to work under some circumstances (a form > with no db access). The xforms-value-changed always works. Is there a > way to initialize the select1 and or select values so that if a user > does takes the default (does not click on the field) the instance > values will always contain a value? > > The companyStatus select1 below get its data from an MS SQL Sever xpl > database query (on submission action xforms-ready). > <xforms:select1 ref="companyStatus"> > <xforms:label class="fieldLabel">Company Status</xforms:label> > <xforms:itemset > nodeset="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-i > ns tance')/row" > model="valueListLK-addFilesystem-companyStatus-7-model"> > <xforms:label class="fieldLabel" ref="label"/> > <xforms:value ref="value"/> > </xforms:itemset> > <xforms:alert>This field is required</xforms:alert> > <xforms:hint/> > > <xforms:action ev:event="xforms-value-changed"> > <xxforms:variable name="theValue" > select="xxforms:instance('addServers-instance')/addFilesystem[xxforms: > in dex('addFilesystem-repeat')]/companyStatus"/> > <xforms:setvalue > ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:ind > ex ('addFilesystem-repeat')]/companyStatus/@label" > value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-ins > ta nce')/row[contains(.//value, $theValue)]/label"/> > </xforms:action> > > <!-- persist initial dropdown values both label and value --> > <xforms:action ev:event="xforms-enabled"> > <xxforms:variable name="theValue" > select="xxforms:instance('addServers-instance')/addFilesystem[xxforms: > in dex('addFilesystem-repeat')]/companyStatus"/> > <xforms:setvalue > ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:ind > ex ('addFilesystem-repeat')]/companyStatus/@label" > value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-ins > ta nce')/row[contains(.//value, $theValue)]/label"/> > <xforms:setvalue > ref="xxforms:instance('addServers-instance')/addFilesystem[xxforms:ind > ex ('addFilesystem-repeat')]/companyStatus" > value="xxforms:instance('valueListLK-addFilesystem-companyStatus-7-ins > ta nce')/row[contains(.//value, $theValue)]/value"/> > </xforms:action> > </xforms:select1> > > Thanks. > > Martin > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik > Bruchez > Sent: Thursday, December 10, 2009 8:16 PM > To: [hidden email] > Subject: [ops-users] Re: Is there any way to create a custom event (or > something) that will fire after the xform-ready event. > > Martin, > > Can you provide an example of what you tried? > > -Erik > > On Thu, Dec 10, 2009 at 4:06 PM, Schwartzman, Martin > <[hidden email]> wrote: >> Is there any way to create a custom event (or something) that will >> fire after the xform-ready event from within the body of the document? > >> I tried implementing the example from the XForms Sandbox Test Samples >> custom-events but it did not fire the event from within the >> <body><repeat><select1/></repeat></body> element of the XForms >> document. I want to initialize the <select1/> bound element value >> with > >> the first items value before a user makes a selection. Should it work >> from within the <select1/> element or no? The code did work when >> implemented in the <model/> element like the example. >> >> >> >> -- >> 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 >> OW2 mailing lists service home page: http://www.ow2.org/wws >> >> > Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws view.xhtml (17K) Download Attachment |
Free forum by Nabble | Edit this page |