Login  Register

Re: Is there any way to create a custom event (or something) that will fire after the xform-ready event.

Posted by Alessandro Vernet on Dec 13, 2009; 3:38am
URL: https://discuss.orbeon.com/Is-there-any-way-to-create-a-custom-event-or-something-that-will-fire-after-the-xform-ready-event-tp960700p962823.html

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