Displaying an error message with a trigger

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

Displaying an error message with a trigger

Chaminda Amarasinghe

Hi All,

This is bit related to my previous post. http://discuss.orbeon.com/Handeling-Service-Response-and-showing-error-messages-tp4656558p4656613.html

I am trying to display a custom global error message using fr:error-summary

My goal is store my custom messages in an model instance called errors, and with a button click and notify the error-summay using triggerid

Following is the full source code, in the form builder i can see the errors in error summary but when I run (using Test button) no error messages appear even the button click,

Can someone give me a hint?

I went through this thread, but no luck for me. http://mail-archive.ow2.org/ops-users/2010-03/msg00091.html

<xh:html 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:exf="http://www.exforms.org/exf/1-0"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:sql="http://orbeon.org/oxf/xml/sql"
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
    <xh:head>
        <xh:title/>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true">

            <!-- Main instance -->
            <xf:instance id="fr-form-instance">
                <form>
                    <section-1>
                        <control-2/>
                       
                    </section-1>
                </form>
            </xf:instance>

             <xf:instance id="errors">
                    <errors>
                        <error>
                            <label>Err Title</label>
                            <alert>Err Msg</alert>
                        </error>
                    </errors>
            </xf:instance>

                           
           
            <!-- Bindings -->
            <xf:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
                     ref="instance('fr-form-instance')">
                <xf:bind id="section-1-bind" name="section-1" ref="section-1">
                    <xf:bind name="control-2" id="control-2-bind" ref="control-2"/>
                   
                </xf:bind>
            </xf:bind>

            <!-- Metadata -->
            <xf:instance xxf:readonly="true" id="fr-form-metadata">
                <metadata>
                    <application-name>custom-error</application-name>
                    <form-name>custom-error-form</form-name>
                    <title xml:lang="en"/>
                    <description xml:lang="en"/>
                </metadata>
            </xf:instance>

            <!-- Attachments -->
            <xf:instance id="fr-form-attachments">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xf:instance>

            <!-- All form resources -->
            <!-- Don't make readonly by default in case a service modifies the resources -->
            <xf:instance id="fr-form-resources" xxf:readonly="false">
                <resources>
                    <resource xml:lang="en">
                        <control-2>
                            <label>Show Errors</label>
                            <help/>
                            <hint/>
                            <alert/>
                        </control-2>
                        <section-1>
                            <label/>
                            <help/>
                        </section-1>
                       
                    </resource>
                </resources>
            </xf:instance>

            <!-- Utility instances for services -->
            <xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
                <request/>
            </xf:instance>

            <xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
                <response/>
            </xf:instance>

        </xf:model>
    </xh:head>
    <xh:body>

        <fr:view>
            <fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
                     xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel"
                     xmlns:oxf="http://www.orbeon.com/oxf/processors"
                     xmlns:p="http://www.orbeon.com/oxf/pipeline">
                            <xf:group id="main-group">                         
                    <fr:section id="section-1-control" bind="section-1-bind">
                        <xf:label ref="$form-resources/section-1/label"/>
                        <xf:help ref="$form-resources/section-1/help"/>
                        <fr:grid>
                            <xh:tr>
                                <xh:td>
                                    <xf:trigger id="control-2-control" bind="control-2-bind">
                                        <xf:label ref="$form-resources/control-2/label"/>
                                        <xf:help ref="$form-resources/control-2/help"/>
                                        <xf:hint ref="$form-resources/control-2/hint"/>
                                        <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                        <xf:action ev:event="DOMActivate">
                                            <xf:dispatch name="fr-visit-all" targetid="error-summary"/>
                                        </xf:action>

                                    </xf:trigger>
                                </xh:td>
                            </xh:tr>
                        </fr:grid>
                    </fr:section>
                         </xf:group>   
            </fr:body>
        </fr:view>
        <fr:error-summary id="error-summary" observer="main-group">
                  <fr:label>Error in this form</fr:label>
            <fr:errors ref="instance('errors')/error">
                   <fr:label ref="label"/>
                <fr:alert ref="alert"/>
            </fr:errors>
        </fr:error-summary>  
        

    </xh:body>
</xh:html>

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

Re: Displaying an error message with a trigger

Chaminda Amarasinghe
A small correction,

Following is the full source code, in the form builder i can see the errors in error summary but when I run (using Test button) no error messages appear even with the button click,

Regards,

On Monday, April 22, 2013 4:01:27 AM UTC+5:30, Chaminda Amarasinghe wrote:

Hi All,

This is bit related to my previous post. http://discuss.orbeon.com/Handeling-Service-Response-and-showing-error-messages-tp4656558p4656613.html

I am trying to display a custom global error message using fr:error-summary

My goal is store my custom messages in an model instance called errors, and with a button click and notify the error-summay using triggerid

Following is the full source code, in the form builder i can see the errors in error summary but when I run (using Test button) no error messages appear even the button click,

Can someone give me a hint?

I went through this thread, but no luck for me. http://mail-archive.ow2.org/ops-users/2010-03/msg00091.html

<xh:html 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:exf="http://www.exforms.org/exf/1-0"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:sql="http://orbeon.org/oxf/xml/sql"
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
    <xh:head>
        <xh:title/>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true">

            <!-- Main instance -->
            <xf:instance id="fr-form-instance">
                <form>
                    <section-1>
                        <control-2/>
                       
                    </section-1>
                </form>
            </xf:instance>

             <xf:instance id="errors">
                    <errors>
                        <error>
                            <label>Err Title</label>
                            <alert>Err Msg</alert>
                        </error>
                    </errors>
            </xf:instance>

                           
           
            <!-- Bindings -->
            <xf:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
                     ref="instance('fr-form-instance')">
                <xf:bind id="section-1-bind" name="section-1" ref="section-1">
                    <xf:bind name="control-2" id="control-2-bind" ref="control-2"/>
                   
                </xf:bind>
            </xf:bind>

            <!-- Metadata -->
            <xf:instance xxf:readonly="true" id="fr-form-metadata">
                <metadata>
                    <application-name>custom-error</application-name>
                    <form-name>custom-error-form</form-name>
                    <title xml:lang="en"/>
                    <description xml:lang="en"/>
                </metadata>
            </xf:instance>

            <!-- Attachments -->
            <xf:instance id="fr-form-attachments">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xf:instance>

            <!-- All form resources -->
            <!-- Don't make readonly by default in case a service modifies the resources -->
            <xf:instance id="fr-form-resources" xxf:readonly="false">
                <resources>
                    <resource xml:lang="en">
                        <control-2>
                            <label>Show Errors</label>
                            <help/>
                            <hint/>
                            <alert/>
                        </control-2>
                        <section-1>
                            <label/>
                            <help/>
                        </section-1>
                       
                    </resource>
                </resources>
            </xf:instance>

            <!-- Utility instances for services -->
            <xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
                <request/>
            </xf:instance>

            <xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
                <response/>
            </xf:instance>

        </xf:model>
    </xh:head>
    <xh:body>

        <fr:view>
            <fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
                     xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel"
                     xmlns:oxf="http://www.orbeon.com/oxf/processors"
                     xmlns:p="http://www.orbeon.com/oxf/pipeline">
                            <xf:group id="main-group">                         
                    <fr:section id="section-1-control" bind="section-1-bind">
                        <xf:label ref="$form-resources/section-1/label"/>
                        <xf:help ref="$form-resources/section-1/help"/>
                        <fr:grid>
                            <xh:tr>
                                <xh:td>
                                    <xf:trigger id="control-2-control" bind="control-2-bind">
                                        <xf:label ref="$form-resources/control-2/label"/>
                                        <xf:help ref="$form-resources/control-2/help"/>
                                        <xf:hint ref="$form-resources/control-2/hint"/>
                                        <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                        <xf:action ev:event="DOMActivate">
                                            <xf:dispatch name="fr-visit-all" targetid="error-summary"/>
                                        </xf:action>

                                    </xf:trigger>
                                </xh:td>
                            </xh:tr>
                        </fr:grid>
                    </fr:section>
                         </xf:group>   
            </fr:body>
        </fr:view>
        <fr:error-summary id="error-summary" observer="main-group">
                  <fr:label>Error in this form</fr:label>
            <fr:errors ref="instance('errors')/error">
                   <fr:label ref="label"/>
                <fr:alert ref="alert"/>
            </fr:errors>
        </fr:error-summary>  
        

    </xh:body>
</xh:html>

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

Re: Displaying an error message with a trigger

Alessandro  Vernet
Administrator
Hi Chaminda,

Hooking up the error summary is more complicated than what you are doing; I am sorry, but what you trying to do is just not supported out of the box. Support for dynamic alert messages in Form Builder is really something that would need to be backed into the product, rather than hacked by editing forms created by Form Builder. If your company has a Dev Support plan (or considers getting one), I'd recommend they can get in touch with us about this (info AT orbeon DOT com).

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

Re: Displaying an error message with a trigger

Chaminda Amarasinghe
Hi Alex,

Thanks for the reply. I will discuss with my big boss :) and let you know.

Regards,
Chaminda

On Tuesday, April 23, 2013 5:56:50 AM UTC+5:30, Alessandro Vernet wrote:
Hi Chaminda,

Hooking up the error summary is more complicated than what you are doing; I
am sorry, but what you trying to do is just not supported out of the box.
Support for dynamic alert messages in Form Builder is really something that
would need to be backed into the product, rather than hacked by editing
forms created by Form Builder. If your company has a Dev Support plan (or
considers getting one), I'd recommend they can get in touch with us about
this (info AT orbeon DOT com).

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/Displaying-an-error-message-with-a-trigger-tp4656624p4656639.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
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].