Loading instance data after model constructed.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Loading instance data after model constructed.

Jeremy Nix
I'm having trouble loading instance data after the page/model has been constructed.  Below is the code that I am using along with a NullPointerException in the orbeon.log that occurs.  I'm not sure if this a bug or I'm simply doing this incorrectly.

//Code...
<xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:exforms="http://www.exforms.org/exf/1-0">
    <xhtml:head>
        <xforms:model id="odm-model" version="1.1" xxforms:external-events="load-initial-data" schema="http://localhost:7070/xforms/xsd/odm1-3-0-foundation.xsd">
            <xforms:instance id="odm-instance">
                <!-- empty container placeholder -->
                <ODM/>
            </xforms:instance>
            <xforms:submission id="odm-submission" resource="http://localhost:7070/xforms/dataentry/saveform" method="post" validate="true()" ref="instance('odm-instance')" />
            <xforms:submission id="read-data" method="get" action="http://localhost:7070/xforms/xml/data.xml" replace="instance" instance="odm-instance">
                <xforms:setvalue model="var-model" ev:event="xforms-submit-done" ref="instance('var-instance')/Status/@loading" value="'false'" />
            </xforms:submission>
            <xxforms:script ev:event="xforms-model-construct-done">
                ORBEON.xforms.Document.dispatchEvent("odm-model", "load-initial-data");
            </xxforms:script>
            <xforms:action ev:event="load-initial-data">
                <xforms:send submission="read-data"/>
            </xforms:action>
        </xforms:model>
        <xforms:model id="var-model">
            <xforms:instance id="var-instance">
                <Variables>
                    <Status loading="true"/>
                </Variables>
            </xforms:instance>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <xforms:group model="var-model" ref="/Variables/Status[normalize-space(@loading) = 'true']" appearance="xxforms:fieldset">
            <xhtml:img src="/images/ajax/ajax_process.gif" alt="loading"/>
            Please wait while the page loads...
        </xforms:group>
        <xforms:group model="odm-model" ref="instance('odm-instance')/ClinicalData[@StudyOID='1']/SubjectData" id="subject-data" appearance="xxforms:fieldset">
            <xforms:group model="odm-model" ref="StudyEventData[@StudyEventOID='1']" appearance="xxforms:internal">
                <xhtml:div class="odm-section-header">
                    <xhtml:span class="odm-section-header-title">Demographics</xhtml:span>
                </xhtml:div>
                <xhtml:table>
                    <xhtml:tr>
                        <xhtml:td style="vertical-align:top">
                            <xhtml:table cellpadding="0" cellspacing="1">
                                <xhtml:tr>
                                    <xhtml:td style="vertical-align:top">
                                        <xhtml:table class="itemgroup" cellpadding="0" cellspacing="0">
                                            <xhtml:tr>
                                                <xhtml:td>
                                                    <xhtml:div class="grid-cell">First Name</xhtml:div>
                                                    <xhtml:div class="grid-cell">Middle Name</xhtml:div>
                                                    <xhtml:div class="grid-cell">Last Name</xhtml:div>
                                                </xhtml:td>
                                            </xhtml:tr>
                                        </xhtml:table>
                                        <xhtml:br/>
                                    </xhtml:td>
                                </xhtml:tr>
                            </xhtml:table>
                        </xhtml:td>
                        <xhtml:td style="vertical-align:top">
                            <xhtml:div class="formdata">
                                <xhtml:table cellpadding="0" cellspacing="1">
                                    <xhtml:tr>
                                        <xforms:group ref="FormData[@FormOID='1']" appearance="xxforms:internal">
                                            <xhtml:td>
                                                <xhtml:table class="itemgroup" cellpadding="0" cellspacing="0">
                                                    <xhtml:tr>
                                                        <xforms:group ref="ItemGroupData[@ItemGroupOID='1']" appearance="xxforms:internal">
                                                            <xhtml:td>
                                                                <xhtml:div class="grid-cell">
                                                                    <xforms:group id="grp_1_1_1_1_2" ref="ItemData[@ItemOID='2']" appearance="xxforms:internal">
                                                                        <xforms:input xxforms:maxlength="25" ref="@Value" />
                                                                    </xforms:group>
                                                                </xhtml:div>
                                                                <xhtml:div class="grid-cell">
                                                                    <xforms:group id="grp_1_1_1_1_3" ref="ItemData[@ItemOID='3']" appearance="xxforms:internal">
                                                                        <xforms:input xxforms:maxlength="25" ref="@Value" />
                                                                    </xforms:group>
                                                                </xhtml:div>
                                                                <xhtml:div class="grid-cell">
                                                                    <xforms:group id="grp_1_1_1_1_4" ref="ItemData[@ItemOID='4']" appearance="xxforms:internal">
                                                                        <xforms:input xxforms:maxlength="25" ref="@Value" />
                                                                    </xforms:group>
                                                                </xhtml:div>
                                                            </xhtml:td>
                                                        </xforms:group>
                                                    </xhtml:tr>
                                                </xhtml:table>
                                            </xhtml:td>
                                        </xforms:group>
                                    </xhtml:tr>
                                </xhtml:table>
                            </xhtml:div>
                        </xhtml:td>
                    </xhtml:tr>
                </xhtml:table>
            </xforms:group>
        </xforms:group>
    </xhtml:body>
</xhtml:html>

//Data.xml
<ODM ODMVersion="1.3" CreationDateTime="2010-03-23T04:28:01.419-04:00" FileOID="000-00-000" FileType="Transactional">
    <ClinicalData MetaDataVersionOID="1" StudyOID="1">
        <SubjectData SubjectKey="3325635">
            <StudyEventData InstanceNum="1" Active="Yes" StudyEventRepeatKey="1" StudyEventOID="1">
                <FormData InstanceNum="1" Active="Yes" FormRepeatKey="1" FormOID="1">
                    <ItemGroupData ItemGroupRepeatKey="1" ItemGroupOID="1" InstanceNum="1" Active="Yes">
                        <ItemData Value="TEST" ItemOID="2"/>
                        <ItemData Value="" ItemOID="3"/>
                        <ItemData Value="TEST2" ItemOID="4"/>
                    </ItemGroupData>
                </FormData>
            </StudyEventData>
        </SubjectData>
    </ClinicalData>
</ODM>

//Error from orbeon.log
2010-03-24 11:12:48,289 ERROR ProcessorService  - Exception at line 55, column 65 of oxf:/ops/xforms/xforms-server.xpl (reading processor output: name='response', id='xforms-response')
java.lang.NullPointerException
    at org.orbeon.oxf.xforms.ControlTree$UpdateBindingsListener.startVisitControl(ControlTree.java:933)
    at org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:424)
    at org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:447)
    at org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:320)
    at org.orbeon.oxf.xforms.XFormsControls.updateBindingsIfNeeded(XFormsControls.java:626)
    at org.orbeon.oxf.xforms.XFormsControls.doRefresh(XFormsControls.java:572)
    at org.orbeon.oxf.xforms.XFormsControls.refreshIfNeeded(XFormsControls.java:110)
    at org.orbeon.oxf.xforms.xbl.XBLContainer.refreshIfNeeded(XBLContainer.java:715)
    ...

Thanks for the help,
--

Jeremy Nix
Senior Application Developer
Cincinnati Children's Hospital Medical Center


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Loading instance data after model constructed.

Alessandro  Vernet
Administrator
Jeremy,

I was unable to reproduce this. I initially got an exception because
the schema could not be loaded, but after commenting the schema, your
example seems to work fine for me. It dispatches the load-initial-data
event and shows http://screencast.com/t/ZGY1MjM0.

Are you seing this with a recent nightly build?

BTW, instead of using xxforms:script, you can use the following, which
I personally like better as you avoid JavaScript altogether (I'll even
take going from 1 to 0 line!):

<xforms:dispatch ev:event="xforms-model-construct-done"
target="odm-model" name="load-initial-data" delay="1"/>

Alex

On Wed, Mar 24, 2010 at 8:15 AM, Jeremy Nix <[hidden email]> wrote:

> I'm having trouble loading instance data after the page/model has been
> constructed.  Below is the code that I am using along with a
> NullPointerException in the orbeon.log that occurs.  I'm not sure if this a
> bug or I'm simply doing this incorrectly.
>
> //Code...
> <xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:fn="http://www.w3.org/2005/xpath-functions"
> xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
> xmlns:xforms="http://www.w3.org/2002/xforms"
> xmlns:xhtml="http://www.w3.org/1999/xhtml"
> xmlns:xi="http://www.w3.org/2001/XInclude"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
> xmlns:exforms="http://www.exforms.org/exf/1-0">
>     <xhtml:head>
>         <xforms:model id="odm-model" version="1.1"
> xxforms:external-events="load-initial-data"
> schema="http://localhost:7070/xforms/xsd/odm1-3-0-foundation.xsd">
>             <xforms:instance id="odm-instance">
>                 <!-- empty container placeholder -->
>                 <ODM/>
>             </xforms:instance>
>             <xforms:submission id="odm-submission"
> resource="http://localhost:7070/xforms/dataentry/saveform" method="post"
> validate="true()" ref="instance('odm-instance')" />
>             <xforms:submission id="read-data" method="get"
> action="http://localhost:7070/xforms/xml/data.xml" replace="instance"
> instance="odm-instance">
>                 <xforms:setvalue model="var-model"
> ev:event="xforms-submit-done" ref="instance('var-instance')/Status/@loading"
> value="'false'" />
>             </xforms:submission>
>             <xxforms:script ev:event="xforms-model-construct-done">
>                 ORBEON.xforms.Document.dispatchEvent("odm-model",
> "load-initial-data");
>             </xxforms:script>
>             <xforms:action ev:event="load-initial-data">
>                 <xforms:send submission="read-data"/>
>             </xforms:action>
>         </xforms:model>
>         <xforms:model id="var-model">
>             <xforms:instance id="var-instance">
>                 <Variables>
>                     <Status loading="true"/>
>                 </Variables>
>             </xforms:instance>
>         </xforms:model>
>     </xhtml:head>
>     <xhtml:body>
>         <xforms:group model="var-model"
> ref="/Variables/Status[normalize-space(@loading) = 'true']"
> appearance="xxforms:fieldset">
>             <xhtml:img src="/images/ajax/ajax_process.gif" alt="loading"/>
>             Please wait while the page loads...
>         </xforms:group>
>         <xforms:group model="odm-model"
> ref="instance('odm-instance')/ClinicalData[@StudyOID='1']/SubjectData"
> id="subject-data" appearance="xxforms:fieldset">
>             <xforms:group model="odm-model"
> ref="StudyEventData[@StudyEventOID='1']" appearance="xxforms:internal">
>                 <xhtml:div class="odm-section-header">
>                     <xhtml:span
> class="odm-section-header-title">Demographics</xhtml:span>
>                 </xhtml:div>
>                 <xhtml:table>
>                     <xhtml:tr>
>                         <xhtml:td style="vertical-align:top">
>                             <xhtml:table cellpadding="0" cellspacing="1">
>                                 <xhtml:tr>
>                                     <xhtml:td style="vertical-align:top">
>                                         <xhtml:table class="itemgroup"
> cellpadding="0" cellspacing="0">
>                                             <xhtml:tr>
>                                                 <xhtml:td>
>                                                     <xhtml:div
> class="grid-cell">First Name</xhtml:div>
>                                                     <xhtml:div
> class="grid-cell">Middle Name</xhtml:div>
>                                                     <xhtml:div
> class="grid-cell">Last Name</xhtml:div>
>                                                 </xhtml:td>
>                                             </xhtml:tr>
>                                         </xhtml:table>
>                                         <xhtml:br/>
>                                     </xhtml:td>
>                                 </xhtml:tr>
>                             </xhtml:table>
>                         </xhtml:td>
>                         <xhtml:td style="vertical-align:top">
>                             <xhtml:div class="formdata">
>                                 <xhtml:table cellpadding="0"
> cellspacing="1">
>                                     <xhtml:tr>
>                                         <xforms:group
> ref="FormData[@FormOID='1']" appearance="xxforms:internal">
>                                             <xhtml:td>
>                                                 <xhtml:table
> class="itemgroup" cellpadding="0" cellspacing="0">
>                                                     <xhtml:tr>
>                                                         <xforms:group
> ref="ItemGroupData[@ItemGroupOID='1']" appearance="xxforms:internal">
>                                                             <xhtml:td>
>                                                                 <xhtml:div
> class="grid-cell">
>
> <xforms:group id="grp_1_1_1_1_2" ref="ItemData[@ItemOID='2']"
> appearance="xxforms:internal">
>
> <xforms:input xxforms:maxlength="25" ref="@Value" />
>
> </xforms:group>
>                                                                 </xhtml:div>
>                                                                 <xhtml:div
> class="grid-cell">
>
> <xforms:group id="grp_1_1_1_1_3" ref="ItemData[@ItemOID='3']"
> appearance="xxforms:internal">
>
> <xforms:input xxforms:maxlength="25" ref="@Value" />
>
> </xforms:group>
>                                                                 </xhtml:div>
>                                                                 <xhtml:div
> class="grid-cell">
>
> <xforms:group id="grp_1_1_1_1_4" ref="ItemData[@ItemOID='4']"
> appearance="xxforms:internal">
>
> <xforms:input xxforms:maxlength="25" ref="@Value" />
>
> </xforms:group>
>                                                                 </xhtml:div>
>                                                             </xhtml:td>
>                                                         </xforms:group>
>                                                     </xhtml:tr>
>                                                 </xhtml:table>
>                                             </xhtml:td>
>                                         </xforms:group>
>                                     </xhtml:tr>
>                                 </xhtml:table>
>                             </xhtml:div>
>                         </xhtml:td>
>                     </xhtml:tr>
>                 </xhtml:table>
>             </xforms:group>
>         </xforms:group>
>     </xhtml:body>
> </xhtml:html>
>
> //Data.xml
> <ODM ODMVersion="1.3" CreationDateTime="2010-03-23T04:28:01.419-04:00"
> FileOID="000-00-000" FileType="Transactional">
>     <ClinicalData MetaDataVersionOID="1" StudyOID="1">
>         <SubjectData SubjectKey="3325635">
>             <StudyEventData InstanceNum="1" Active="Yes"
> StudyEventRepeatKey="1" StudyEventOID="1">
>                 <FormData InstanceNum="1" Active="Yes" FormRepeatKey="1"
> FormOID="1">
>                     <ItemGroupData ItemGroupRepeatKey="1" ItemGroupOID="1"
> InstanceNum="1" Active="Yes">
>                         <ItemData Value="TEST" ItemOID="2"/>
>                         <ItemData Value="" ItemOID="3"/>
>                         <ItemData Value="TEST2" ItemOID="4"/>
>                     </ItemGroupData>
>                 </FormData>
>             </StudyEventData>
>         </SubjectData>
>     </ClinicalData>
> </ODM>
>
> //Error from orbeon.log
> 2010-03-24 11:12:48,289 ERROR ProcessorService  - Exception at line 55,
> column 65 of oxf:/ops/xforms/xforms-server.xpl (reading processor output:
> name='response', id='xforms-response')
> java.lang.NullPointerException
>     at
> org.orbeon.oxf.xforms.ControlTree$UpdateBindingsListener.startVisitControl(ControlTree.java:933)
>     at
> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:424)
>     at
> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:447)
>     at
> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:320)
>     at
> org.orbeon.oxf.xforms.XFormsControls.updateBindingsIfNeeded(XFormsControls.java:626)
>     at
> org.orbeon.oxf.xforms.XFormsControls.doRefresh(XFormsControls.java:572)
>     at
> org.orbeon.oxf.xforms.XFormsControls.refreshIfNeeded(XFormsControls.java:110)
>     at
> org.orbeon.oxf.xforms.xbl.XBLContainer.refreshIfNeeded(XBLContainer.java:715)
>     ...
>
> Thanks for the help,
> --
> ________________________________
> Jeremy Nix
> Senior Application Developer
> Cincinnati Children's Hospital Medical Center
>
>
> --
> 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 -
http://www.orbeon.com/
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Loading instance data after model constructed.

Jeremy Nix
Alex,

After using the dispatch tag, the page worked properly.  I am using a
development snapshot from this week (2010-03-23).  I did go back and try
my code against the 3.7.1 release and it did work with the xx:script
tag.  I also grabbed todays development snapshot and tried it both with
the xx:script tag and with the dispatch tag, and it worked for both
cases.  Not sure what was going on.

Thanks for help.

------------------------------------------------------------------------
Jeremy Nix
Senior Application Developer
Cincinnati Children's Hospital Medical Center

On 03/25/2010 01:55 AM, Alessandro Vernet wrote:

> Jeremy,
>
> I was unable to reproduce this. I initially got an exception because
> the schema could not be loaded, but after commenting the schema, your
> example seems to work fine for me. It dispatches the load-initial-data
> event and shows http://screencast.com/t/ZGY1MjM0.
>
> Are you seing this with a recent nightly build?
>
> BTW, instead of using xxforms:script, you can use the following, which
> I personally like better as you avoid JavaScript altogether (I'll even
> take going from 1 to 0 line!):
>
> <xforms:dispatch ev:event="xforms-model-construct-done"
> target="odm-model" name="load-initial-data" delay="1"/>
>
> Alex
>
> On Wed, Mar 24, 2010 at 8:15 AM, Jeremy Nix<[hidden email]>  wrote:
>    
>> I'm having trouble loading instance data after the page/model has been
>> constructed.  Below is the code that I am using along with a
>> NullPointerException in the orbeon.log that occurs.  I'm not sure if this a
>> bug or I'm simply doing this incorrectly.
>>
>> //Code...
>> <xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events"
>> xmlns:fn="http://www.w3.org/2005/xpath-functions"
>> xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
>> xmlns:xforms="http://www.w3.org/2002/xforms"
>> xmlns:xhtml="http://www.w3.org/1999/xhtml"
>> xmlns:xi="http://www.w3.org/2001/XInclude"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
>> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
>> xmlns:exforms="http://www.exforms.org/exf/1-0">
>>      <xhtml:head>
>>          <xforms:model id="odm-model" version="1.1"
>> xxforms:external-events="load-initial-data"
>> schema="http://localhost:7070/xforms/xsd/odm1-3-0-foundation.xsd">
>>              <xforms:instance id="odm-instance">
>>                  <!-- empty container placeholder -->
>>                  <ODM/>
>>              </xforms:instance>
>>              <xforms:submission id="odm-submission"
>> resource="http://localhost:7070/xforms/dataentry/saveform" method="post"
>> validate="true()" ref="instance('odm-instance')" />
>>              <xforms:submission id="read-data" method="get"
>> action="http://localhost:7070/xforms/xml/data.xml" replace="instance"
>> instance="odm-instance">
>>                  <xforms:setvalue model="var-model"
>> ev:event="xforms-submit-done" ref="instance('var-instance')/Status/@loading"
>> value="'false'" />
>>              </xforms:submission>
>>              <xxforms:script ev:event="xforms-model-construct-done">
>>                  ORBEON.xforms.Document.dispatchEvent("odm-model",
>> "load-initial-data");
>>              </xxforms:script>
>>              <xforms:action ev:event="load-initial-data">
>>                  <xforms:send submission="read-data"/>
>>              </xforms:action>
>>          </xforms:model>
>>          <xforms:model id="var-model">
>>              <xforms:instance id="var-instance">
>>                  <Variables>
>>                      <Status loading="true"/>
>>                  </Variables>
>>              </xforms:instance>
>>          </xforms:model>
>>      </xhtml:head>
>>      <xhtml:body>
>>          <xforms:group model="var-model"
>> ref="/Variables/Status[normalize-space(@loading) = 'true']"
>> appearance="xxforms:fieldset">
>>              <xhtml:img src="/images/ajax/ajax_process.gif" alt="loading"/>
>>              Please wait while the page loads...
>>          </xforms:group>
>>          <xforms:group model="odm-model"
>> ref="instance('odm-instance')/ClinicalData[@StudyOID='1']/SubjectData"
>> id="subject-data" appearance="xxforms:fieldset">
>>              <xforms:group model="odm-model"
>> ref="StudyEventData[@StudyEventOID='1']" appearance="xxforms:internal">
>>                  <xhtml:div class="odm-section-header">
>>                      <xhtml:span
>> class="odm-section-header-title">Demographics</xhtml:span>
>>                  </xhtml:div>
>>                  <xhtml:table>
>>                      <xhtml:tr>
>>                          <xhtml:td style="vertical-align:top">
>>                              <xhtml:table cellpadding="0" cellspacing="1">
>>                                  <xhtml:tr>
>>                                      <xhtml:td style="vertical-align:top">
>>                                          <xhtml:table class="itemgroup"
>> cellpadding="0" cellspacing="0">
>>                                              <xhtml:tr>
>>                                                  <xhtml:td>
>>                                                      <xhtml:div
>> class="grid-cell">First Name</xhtml:div>
>>                                                      <xhtml:div
>> class="grid-cell">Middle Name</xhtml:div>
>>                                                      <xhtml:div
>> class="grid-cell">Last Name</xhtml:div>
>>                                                  </xhtml:td>
>>                                              </xhtml:tr>
>>                                          </xhtml:table>
>>                                          <xhtml:br/>
>>                                      </xhtml:td>
>>                                  </xhtml:tr>
>>                              </xhtml:table>
>>                          </xhtml:td>
>>                          <xhtml:td style="vertical-align:top">
>>                              <xhtml:div class="formdata">
>>                                  <xhtml:table cellpadding="0"
>> cellspacing="1">
>>                                      <xhtml:tr>
>>                                          <xforms:group
>> ref="FormData[@FormOID='1']" appearance="xxforms:internal">
>>                                              <xhtml:td>
>>                                                  <xhtml:table
>> class="itemgroup" cellpadding="0" cellspacing="0">
>>                                                      <xhtml:tr>
>>                                                          <xforms:group
>> ref="ItemGroupData[@ItemGroupOID='1']" appearance="xxforms:internal">
>>                                                              <xhtml:td>
>>                                                                  <xhtml:div
>> class="grid-cell">
>>
>> <xforms:group id="grp_1_1_1_1_2" ref="ItemData[@ItemOID='2']"
>> appearance="xxforms:internal">
>>
>> <xforms:input xxforms:maxlength="25" ref="@Value" />
>>
>> </xforms:group>
>>                                                                  </xhtml:div>
>>                                                                  <xhtml:div
>> class="grid-cell">
>>
>> <xforms:group id="grp_1_1_1_1_3" ref="ItemData[@ItemOID='3']"
>> appearance="xxforms:internal">
>>
>> <xforms:input xxforms:maxlength="25" ref="@Value" />
>>
>> </xforms:group>
>>                                                                  </xhtml:div>
>>                                                                  <xhtml:div
>> class="grid-cell">
>>
>> <xforms:group id="grp_1_1_1_1_4" ref="ItemData[@ItemOID='4']"
>> appearance="xxforms:internal">
>>
>> <xforms:input xxforms:maxlength="25" ref="@Value" />
>>
>> </xforms:group>
>>                                                                  </xhtml:div>
>>                                                              </xhtml:td>
>>                                                          </xforms:group>
>>                                                      </xhtml:tr>
>>                                                  </xhtml:table>
>>                                              </xhtml:td>
>>                                          </xforms:group>
>>                                      </xhtml:tr>
>>                                  </xhtml:table>
>>                              </xhtml:div>
>>                          </xhtml:td>
>>                      </xhtml:tr>
>>                  </xhtml:table>
>>              </xforms:group>
>>          </xforms:group>
>>      </xhtml:body>
>> </xhtml:html>
>>
>> //Data.xml
>> <ODM ODMVersion="1.3" CreationDateTime="2010-03-23T04:28:01.419-04:00"
>> FileOID="000-00-000" FileType="Transactional">
>>      <ClinicalData MetaDataVersionOID="1" StudyOID="1">
>>          <SubjectData SubjectKey="3325635">
>>              <StudyEventData InstanceNum="1" Active="Yes"
>> StudyEventRepeatKey="1" StudyEventOID="1">
>>                  <FormData InstanceNum="1" Active="Yes" FormRepeatKey="1"
>> FormOID="1">
>>                      <ItemGroupData ItemGroupRepeatKey="1" ItemGroupOID="1"
>> InstanceNum="1" Active="Yes">
>>                          <ItemData Value="TEST" ItemOID="2"/>
>>                          <ItemData Value="" ItemOID="3"/>
>>                          <ItemData Value="TEST2" ItemOID="4"/>
>>                      </ItemGroupData>
>>                  </FormData>
>>              </StudyEventData>
>>          </SubjectData>
>>      </ClinicalData>
>> </ODM>
>>
>> //Error from orbeon.log
>> 2010-03-24 11:12:48,289 ERROR ProcessorService  - Exception at line 55,
>> column 65 of oxf:/ops/xforms/xforms-server.xpl (reading processor output:
>> name='response', id='xforms-response')
>> java.lang.NullPointerException
>>      at
>> org.orbeon.oxf.xforms.ControlTree$UpdateBindingsListener.startVisitControl(ControlTree.java:933)
>>      at
>> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:424)
>>      at
>> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:447)
>>      at
>> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:320)
>>      at
>> org.orbeon.oxf.xforms.XFormsControls.updateBindingsIfNeeded(XFormsControls.java:626)
>>      at
>> org.orbeon.oxf.xforms.XFormsControls.doRefresh(XFormsControls.java:572)
>>      at
>> org.orbeon.oxf.xforms.XFormsControls.refreshIfNeeded(XFormsControls.java:110)
>>      at
>> org.orbeon.oxf.xforms.xbl.XBLContainer.refreshIfNeeded(XBLContainer.java:715)
>>      ...
>>
>> Thanks for the help,
>> --
>> ________________________________
>> Jeremy Nix
>> Senior Application Developer
>> Cincinnati Children's Hospital Medical Center
>>
>>
>> --
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Loading instance data after model constructed.

Alessandro  Vernet
Administrator
Jeremy,

Good. And thank you for confirming this works both with the
xxforms:script and xforms:dispatch.

Alex

On Thu, Mar 25, 2010 at 5:36 AM, Jeremy Nix <[hidden email]> wrote:

> Alex,
>
> After using the dispatch tag, the page worked properly.  I am using a
> development snapshot from this week (2010-03-23).  I did go back and try my
> code against the 3.7.1 release and it did work with the xx:script tag.  I
> also grabbed todays development snapshot and tried it both with the
> xx:script tag and with the dispatch tag, and it worked for both cases.  Not
> sure what was going on.
>
> Thanks for help.
>
> ------------------------------------------------------------------------
> Jeremy Nix
> Senior Application Developer
> Cincinnati Children's Hospital Medical Center
>
> On 03/25/2010 01:55 AM, Alessandro Vernet wrote:
>>
>> Jeremy,
>>
>> I was unable to reproduce this. I initially got an exception because
>> the schema could not be loaded, but after commenting the schema, your
>> example seems to work fine for me. It dispatches the load-initial-data
>> event and shows http://screencast.com/t/ZGY1MjM0.
>>
>> Are you seing this with a recent nightly build?
>>
>> BTW, instead of using xxforms:script, you can use the following, which
>> I personally like better as you avoid JavaScript altogether (I'll even
>> take going from 1 to 0 line!):
>>
>> <xforms:dispatch ev:event="xforms-model-construct-done"
>> target="odm-model" name="load-initial-data" delay="1"/>
>>
>> Alex
>>
>> On Wed, Mar 24, 2010 at 8:15 AM, Jeremy Nix<[hidden email]>  wrote:
>>
>>>
>>> I'm having trouble loading instance data after the page/model has been
>>> constructed.  Below is the code that I am using along with a
>>> NullPointerException in the orbeon.log that occurs.  I'm not sure if this
>>> a
>>> bug or I'm simply doing this incorrectly.
>>>
>>> //Code...
>>> <xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events"
>>> xmlns:fn="http://www.w3.org/2005/xpath-functions"
>>> xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
>>> xmlns:xforms="http://www.w3.org/2002/xforms"
>>> xmlns:xhtml="http://www.w3.org/1999/xhtml"
>>> xmlns:xi="http://www.w3.org/2001/XInclude"
>>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>> xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
>>> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
>>> xmlns:exforms="http://www.exforms.org/exf/1-0">
>>>     <xhtml:head>
>>>         <xforms:model id="odm-model" version="1.1"
>>> xxforms:external-events="load-initial-data"
>>> schema="http://localhost:7070/xforms/xsd/odm1-3-0-foundation.xsd">
>>>             <xforms:instance id="odm-instance">
>>>                 <!-- empty container placeholder -->
>>>                 <ODM/>
>>>             </xforms:instance>
>>>             <xforms:submission id="odm-submission"
>>> resource="http://localhost:7070/xforms/dataentry/saveform" method="post"
>>> validate="true()" ref="instance('odm-instance')" />
>>>             <xforms:submission id="read-data" method="get"
>>> action="http://localhost:7070/xforms/xml/data.xml" replace="instance"
>>> instance="odm-instance">
>>>                 <xforms:setvalue model="var-model"
>>> ev:event="xforms-submit-done"
>>> ref="instance('var-instance')/Status/@loading"
>>> value="'false'" />
>>>             </xforms:submission>
>>>             <xxforms:script ev:event="xforms-model-construct-done">
>>>                 ORBEON.xforms.Document.dispatchEvent("odm-model",
>>> "load-initial-data");
>>>             </xxforms:script>
>>>             <xforms:action ev:event="load-initial-data">
>>>                 <xforms:send submission="read-data"/>
>>>             </xforms:action>
>>>         </xforms:model>
>>>         <xforms:model id="var-model">
>>>             <xforms:instance id="var-instance">
>>>                 <Variables>
>>>                     <Status loading="true"/>
>>>                 </Variables>
>>>             </xforms:instance>
>>>         </xforms:model>
>>>     </xhtml:head>
>>>     <xhtml:body>
>>>         <xforms:group model="var-model"
>>> ref="/Variables/Status[normalize-space(@loading) = 'true']"
>>> appearance="xxforms:fieldset">
>>>             <xhtml:img src="/images/ajax/ajax_process.gif"
>>> alt="loading"/>
>>>             Please wait while the page loads...
>>>         </xforms:group>
>>>         <xforms:group model="odm-model"
>>> ref="instance('odm-instance')/ClinicalData[@StudyOID='1']/SubjectData"
>>> id="subject-data" appearance="xxforms:fieldset">
>>>             <xforms:group model="odm-model"
>>> ref="StudyEventData[@StudyEventOID='1']" appearance="xxforms:internal">
>>>                 <xhtml:div class="odm-section-header">
>>>                     <xhtml:span
>>> class="odm-section-header-title">Demographics</xhtml:span>
>>>                 </xhtml:div>
>>>                 <xhtml:table>
>>>                     <xhtml:tr>
>>>                         <xhtml:td style="vertical-align:top">
>>>                             <xhtml:table cellpadding="0" cellspacing="1">
>>>                                 <xhtml:tr>
>>>                                     <xhtml:td style="vertical-align:top">
>>>                                         <xhtml:table class="itemgroup"
>>> cellpadding="0" cellspacing="0">
>>>                                             <xhtml:tr>
>>>                                                 <xhtml:td>
>>>                                                     <xhtml:div
>>> class="grid-cell">First Name</xhtml:div>
>>>                                                     <xhtml:div
>>> class="grid-cell">Middle Name</xhtml:div>
>>>                                                     <xhtml:div
>>> class="grid-cell">Last Name</xhtml:div>
>>>                                                 </xhtml:td>
>>>                                             </xhtml:tr>
>>>                                         </xhtml:table>
>>>                                         <xhtml:br/>
>>>                                     </xhtml:td>
>>>                                 </xhtml:tr>
>>>                             </xhtml:table>
>>>                         </xhtml:td>
>>>                         <xhtml:td style="vertical-align:top">
>>>                             <xhtml:div class="formdata">
>>>                                 <xhtml:table cellpadding="0"
>>> cellspacing="1">
>>>                                     <xhtml:tr>
>>>                                         <xforms:group
>>> ref="FormData[@FormOID='1']" appearance="xxforms:internal">
>>>                                             <xhtml:td>
>>>                                                 <xhtml:table
>>> class="itemgroup" cellpadding="0" cellspacing="0">
>>>                                                     <xhtml:tr>
>>>                                                         <xforms:group
>>> ref="ItemGroupData[@ItemGroupOID='1']" appearance="xxforms:internal">
>>>                                                             <xhtml:td>
>>>
>>> <xhtml:div
>>> class="grid-cell">
>>>
>>> <xforms:group id="grp_1_1_1_1_2" ref="ItemData[@ItemOID='2']"
>>> appearance="xxforms:internal">
>>>
>>> <xforms:input xxforms:maxlength="25" ref="@Value" />
>>>
>>> </xforms:group>
>>>
>>> </xhtml:div>
>>>
>>> <xhtml:div
>>> class="grid-cell">
>>>
>>> <xforms:group id="grp_1_1_1_1_3" ref="ItemData[@ItemOID='3']"
>>> appearance="xxforms:internal">
>>>
>>> <xforms:input xxforms:maxlength="25" ref="@Value" />
>>>
>>> </xforms:group>
>>>
>>> </xhtml:div>
>>>
>>> <xhtml:div
>>> class="grid-cell">
>>>
>>> <xforms:group id="grp_1_1_1_1_4" ref="ItemData[@ItemOID='4']"
>>> appearance="xxforms:internal">
>>>
>>> <xforms:input xxforms:maxlength="25" ref="@Value" />
>>>
>>> </xforms:group>
>>>
>>> </xhtml:div>
>>>                                                             </xhtml:td>
>>>                                                         </xforms:group>
>>>                                                     </xhtml:tr>
>>>                                                 </xhtml:table>
>>>                                             </xhtml:td>
>>>                                         </xforms:group>
>>>                                     </xhtml:tr>
>>>                                 </xhtml:table>
>>>                             </xhtml:div>
>>>                         </xhtml:td>
>>>                     </xhtml:tr>
>>>                 </xhtml:table>
>>>             </xforms:group>
>>>         </xforms:group>
>>>     </xhtml:body>
>>> </xhtml:html>
>>>
>>> //Data.xml
>>> <ODM ODMVersion="1.3" CreationDateTime="2010-03-23T04:28:01.419-04:00"
>>> FileOID="000-00-000" FileType="Transactional">
>>>     <ClinicalData MetaDataVersionOID="1" StudyOID="1">
>>>         <SubjectData SubjectKey="3325635">
>>>             <StudyEventData InstanceNum="1" Active="Yes"
>>> StudyEventRepeatKey="1" StudyEventOID="1">
>>>                 <FormData InstanceNum="1" Active="Yes" FormRepeatKey="1"
>>> FormOID="1">
>>>                     <ItemGroupData ItemGroupRepeatKey="1"
>>> ItemGroupOID="1"
>>> InstanceNum="1" Active="Yes">
>>>                         <ItemData Value="TEST" ItemOID="2"/>
>>>                         <ItemData Value="" ItemOID="3"/>
>>>                         <ItemData Value="TEST2" ItemOID="4"/>
>>>                     </ItemGroupData>
>>>                 </FormData>
>>>             </StudyEventData>
>>>         </SubjectData>
>>>     </ClinicalData>
>>> </ODM>
>>>
>>> //Error from orbeon.log
>>> 2010-03-24 11:12:48,289 ERROR ProcessorService  - Exception at line 55,
>>> column 65 of oxf:/ops/xforms/xforms-server.xpl (reading processor output:
>>> name='response', id='xforms-response')
>>> java.lang.NullPointerException
>>>     at
>>>
>>> org.orbeon.oxf.xforms.ControlTree$UpdateBindingsListener.startVisitControl(ControlTree.java:933)
>>>     at
>>>
>>> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:424)
>>>     at
>>>
>>> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:447)
>>>     at
>>>
>>> org.orbeon.oxf.xforms.XFormsControls.visitControlElementsHandleRepeat(XFormsControls.java:320)
>>>     at
>>>
>>> org.orbeon.oxf.xforms.XFormsControls.updateBindingsIfNeeded(XFormsControls.java:626)
>>>     at
>>> org.orbeon.oxf.xforms.XFormsControls.doRefresh(XFormsControls.java:572)
>>>     at
>>>
>>> org.orbeon.oxf.xforms.XFormsControls.refreshIfNeeded(XFormsControls.java:110)
>>>     at
>>>
>>> org.orbeon.oxf.xforms.xbl.XBLContainer.refreshIfNeeded(XBLContainer.java:715)
>>>     ...
>>>
>>> Thanks for the help,
>>> --
>>> ________________________________
>>> Jeremy Nix
>>> Senior Application Developer
>>> Cincinnati Children's Hospital Medical Center
>>>
>>>
>>> --
>>> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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