Exception when using a custom component from form builder

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

Exception when using a custom component from form builder

Anthony
Hi All.

I am having trouble accessing custom components from within form builder in Orbeon-PE 4.2.

I have created a simple component from the tutorial:

<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
    xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
    xmlns:xbl="http://www.w3.org/ns/xbl"
    xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
    
    <xbl:binding element="fr|abn" id="fr-abn-input" xxbl:mode="lhha binding value">
        <xbl:template>
            <!-- Input points to the external single-node binding -->
            <xf:input ref="xxf:binding('fr-abn-input')"/>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

And then added it to the component list:

 <property as="xs:string"  name="oxf.fb.toolbox.group.typed.uri.*.*"              
        value="oxf:/forms/orbeon/builder/xbl/typed-controls.xbl
        oxf:/xbl/orbeon/us-phone/us-phone.xbl
        oxf:/xbl/sp/abn/abn.xbl
        oxf:/xbl/orbeon/number/number.xbl
        oxf:/xbl/orbeon/currency/currency.xbl
        oxf:/xbl/orbeon/us-state/us-state.xbl"/>

The component comes up as available in the form builder - if I specify an icon for it, I can see the icon ok.  I can drop it on to the form, but I can't see any fields in it, and as soon as I access it (click inside it) I get the following exception (full log attached):

|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|java.lang.NullPointerException                                                                                        |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/ops/xforms/xforms-server.xpl                        |  43|  65|reading processor output                          |
|----------------------------------------------------------------------------------------------------------------------|
|Exception: java.lang.NullPointerException                                                                             |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.xforms.XFormsContainingDocument     |getObjectByEffectiveId        |XFormsContainingDocument.java | 551|
|org.orbeon.oxf.xforms.event.ClientEvents$          |org$orbeon$oxf$xforms$event$Cl|ClientEvents.scala            | 226|
|org.orbeon.oxf.xforms.event.ClientEvents$$anonfun$c|apply                         |ClientEvents.scala            | 119|



I'm sure I'm missing something obvious here.  Any help would be appreciated.

Thanks and regards,
Anthony

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
 
 

orbeon.log (55K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Exception when using a custom component from form builder

Alessandro  Vernet
Administrator
Hi Anthony,

Because your component is in the Form Runner namespace (http://orbeon.org/oxf/xml/form-runner), it needs to be in the xbl/orbeon directory; you can't put it in xbl/sp. And in case you wonder, the mapping from namespace to directory is done with a property, in this case:

    <property as="xs:string"  name="oxf.xforms.xbl.mapping.orbeon"
        value="http://orbeon.org/oxf/xml/form-runner"/>

And of course, for the component to work in Form Builder, you need to have a metadata section for Form Builder. Here is the updated component:

    <xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
        xmlns:xf="http://www.w3.org/2002/xforms"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:ev="http://www.w3.org/2001/xml-events"
        xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
        xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
        xmlns:xbl="http://www.w3.org/ns/xbl"
        xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
   
        <xbl:binding element="fr|abn" id="fr-abn-input" xxbl:mode="lhha binding value">
            <metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
                <display-name lang="en">ABN</display-name>
                <description lang="en"/>
                <icon lang="en">
                    <small-icon>/apps/fr/style/images/silk/money_dollar.png</small-icon>
                    <large-icon>/apps/fr/style/images/silk/money_dollar.png</large-icon>
                </icon>
                <template>
                    <fr:abn>
                        <xf:label ref="" />
                        <xf:hint ref="" />
                        <xf:help ref="" />
                        <xf:alert ref="" />
                    </fr:abn>
                </template>
            </metadata>
            <xbl:template>
               
                <xf:input ref="xxf:binding('fr-abn-input')"/>
            </xbl:template>
        </xbl:binding>
    </xbl:xbl>

And this works fine, as far as I can tell.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Exception when using a custom component from form builder

Anthony
In reply to this post by Anthony
Hi Alesandro.

Thank you for that.  That was definitely the issue.  

I have attached the component for reference - to be installed in the resources/xbl/sp/abn subdirectory.  It's only a demo but may be useful for others.

Property to map the namespace to the class is:
    <property as="xs:string"  name="oxf.xforms.xbl.mapping.sp" value="http://sp.com.au/orbeon"/>

Property to add the component to the form builder toolbox in the 'typed' group is:
    <property as="xs:string"  name="oxf.fb.toolbox.group.typed.uri.*.*"              
        value="oxf:/forms/orbeon/builder/xbl/typed-controls.xbl
        oxf:/xbl/orbeon/us-phone/us-phone.xbl
        oxf:/xbl/orbeon/number/number.xbl
        oxf:/xbl/sp/abn/abn.xbl
        oxf:/xbl/orbeon/currency/currency.xbl
        oxf:/xbl/orbeon/us-state/us-state.xbl"/>


Thanks again and regards,
Anthony


On Wednesday, June 12, 2013 5:08:02 AM UTC+10, Anthony Marendy wrote:
Hi All.

I am having trouble accessing custom components from within form builder in Orbeon-PE 4.2.

I have created a simple component from the tutorial:

<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
    xmlns:xbl="http://www.w3.org/ns/xbl"
    xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
    
    <xbl:binding element="fr|abn" id="fr-abn-input" xxbl:mode="lhha binding value">
        <xbl:template>
            <!-- Input points to the external single-node binding -->
            <xf:input ref="xxf:binding('fr-abn-input')"/>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

And then added it to the component list:

 <property as="xs:string"  name="oxf.fb.toolbox.group.typed.uri.*.*"              
        value="oxf:/forms/orbeon/builder/xbl/typed-controls.xbl
        oxf:/xbl/orbeon/us-phone/us-phone.xbl
        oxf:/xbl/sp/abn/abn.xbl
        oxf:/xbl/orbeon/number/number.xbl
        oxf:/xbl/orbeon/currency/currency.xbl
        oxf:/xbl/orbeon/us-state/us-state.xbl"/>

The component comes up as available in the form builder - if I specify an icon for it, I can see the icon ok.  I can drop it on to the form, but I can't see any fields in it, and as soon as I access it (click inside it) I get the following exception (full log attached):

|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|java.lang.NullPointerException                                                                                        |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/ops/xforms/xforms-server.xpl                        |  43|  65|reading processor output                          |
|----------------------------------------------------------------------------------------------------------------------|
|Exception: java.lang.NullPointerException                                                                             |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.xforms.XFormsContainingDocument     |getObjectByEffectiveId        |XFormsContainingDocument.java | 551|
|org.orbeon.oxf.xforms.event.ClientEvents$          |org$orbeon$oxf$xforms$event$Cl|ClientEvents.scala            | 226|
|org.orbeon.oxf.xforms.event.ClientEvents$$anonfun$c|apply                         |ClientEvents.scala            | 119|



I'm sure I'm missing something obvious here.  Any help would be appreciated.

Thanks and regards,
Anthony

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
 
 

abn.css (160 bytes) Download Attachment
abn.xbl (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Exception when using a custom component from form builder

Erik Bruchez
Administrator
Anthony,

Thanks for sharing!

-Erik

On Thu, Jun 20, 2013 at 2:54 AM, Anthony Marendy <[hidden email]> wrote:

> Hi Alesandro.
>
> Thank you for that.  That was definitely the issue.
>
> I have attached the component for reference - to be installed in the
> resources/xbl/sp/abn subdirectory.  It's only a demo but may be useful for
> others.
>
> Property to map the namespace to the class is:
>     <property as="xs:string"  name="oxf.xforms.xbl.mapping.sp"
> value="http://sp.com.au/orbeon"/>
>
> Property to add the component to the form builder toolbox in the 'typed'
> group is:
>     <property as="xs:string"  name="oxf.fb.toolbox.group.typed.uri.*.*"
>         value="oxf:/forms/orbeon/builder/xbl/typed-controls.xbl
>         oxf:/xbl/orbeon/us-phone/us-phone.xbl
>         oxf:/xbl/orbeon/number/number.xbl
>         oxf:/xbl/sp/abn/abn.xbl
>         oxf:/xbl/orbeon/currency/currency.xbl
>         oxf:/xbl/orbeon/us-state/us-state.xbl"/>
>
>
> Thanks again and regards,
> Anthony
>
>
> On Wednesday, June 12, 2013 5:08:02 AM UTC+10, Anthony Marendy wrote:
>>
>> Hi All.
>>
>> I am having trouble accessing custom components from within form builder
>> in Orbeon-PE 4.2.
>>
>> I have created a simple component from the tutorial:
>>
>> <xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
>>     xmlns:xf="http://www.w3.org/2002/xforms"
>>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>     xmlns:ev="http://www.w3.org/2001/xml-events"
>>     xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
>>     xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
>>     xmlns:xbl="http://www.w3.org/ns/xbl"
>>     xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
>>
>>     <xbl:binding element="fr|abn" id="fr-abn-input" xxbl:mode="lhha
>> binding value">
>>         <xbl:template>
>>             <!-- Input points to the external single-node binding -->
>>             <xf:input ref="xxf:binding('fr-abn-input')"/>
>>         </xbl:template>
>>     </xbl:binding>
>> </xbl:xbl>
>>
>> And then added it to the component list:
>>
>>  <property as="xs:string"  name="oxf.fb.toolbox.group.typed.uri.*.*"
>>         value="oxf:/forms/orbeon/builder/xbl/typed-controls.xbl
>>         oxf:/xbl/orbeon/us-phone/us-phone.xbl
>>         oxf:/xbl/sp/abn/abn.xbl
>>         oxf:/xbl/orbeon/number/number.xbl
>>         oxf:/xbl/orbeon/currency/currency.xbl
>>         oxf:/xbl/orbeon/us-state/us-state.xbl"/>
>>
>> The component comes up as available in the form builder - if I specify an
>> icon for it, I can see the icon ok.  I can drop it on to the form, but I
>> can't see any fields in it, and as soon as I access it (click inside it) I
>> get the following exception (full log attached):
>>
>> |An Error has Occurred
>> |
>>
>> |----------------------------------------------------------------------------------------------------------------------|
>> |java.lang.NullPointerException
>> |
>>
>> |----------------------------------------------------------------------------------------------------------------------|
>> |Application Call Stack
>> |
>>
>> |----------------------------------------------------------------------------------------------------------------------|
>> |oxf:/ops/xforms/xforms-server.xpl                        |  43|
>> 65|reading processor output                          |
>>
>> |----------------------------------------------------------------------------------------------------------------------|
>> |Exception: java.lang.NullPointerException
>> |
>>
>> |----------------------------------------------------------------------------------------------------------------------|
>> |org.orbeon.oxf.xforms.XFormsContainingDocument
>> |getObjectByEffectiveId        |XFormsContainingDocument.java | 551|
>> |org.orbeon.oxf.xforms.event.ClientEvents$
>> |org$orbeon$oxf$xforms$event$Cl|ClientEvents.scala            | 226|
>> |org.orbeon.oxf.xforms.event.ClientEvents$$anonfun$c|apply
>> |ClientEvents.scala            | 119|
>>
>>
>>
>> I'm sure I'm missing something obvious here.  Any help would be
>> appreciated.
>>
>> Thanks and regards,
>> Anthony
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Orbeon Forms" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> To post to this group, send email to [hidden email].
>
>

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].