Display event body in xforms-submit-error

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

Display event body in xforms-submit-error

James Gu
Hi,

I get the event body in xforms-submit-error and set it into a instance.

    <xforms:submission id="test"
                       ref="instance('request')"
                       replace="instance"
                       instance="response"
                       method="post"
                       action="/getdata">
        <xforms:action ev:event="xforms-submit-error">
               <xforms:setvalue ref="instance('submission-error')/body" value="event('body')"/>
        </xforms:action>
    </xforms:submission>
           
The event body is an html page with error message. I use xforms:output to display the event body as html on page buit it doesn't work.

<xforms:output ref="instance('submission-error')/body" mediatype="text/html" />

I got a error message:
Exception in client-side code
Message: Unknown runtime error

Is there any way to display correctly?

Thanks,
James











Reply | Threaded
Open this post in threaded view
|

Re: Display event body in xforms-submit-error

James Gu
Is there anyone can help this?

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: Re: Display event body in xforms-submit-error

Erik Bruchez
Administrator
This is with a recent build?

If so, can you set the two properties to "false" as described here:

http://sites.google.com/a/orbeon.com/forms/doc/contributor-guide/javascript-development#TOC-Getting-Ready

Then you should get a useful file and line number for the JS exception.

-Erik

On Apr 15, 2009, at 1:41 AM, JamesGu wrote:

>
> Is there anyone can help this?
>
> Thanks,
> James
> --  
> View this message in context: http://www.nabble.com/Display-event-body-in-xforms-submit-error-tp22927802p23055013.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> 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 for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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: Display event body in xforms-submit-error

James Gu
Erik,

Thank you for your help.
I debugged in javascript and found there are same ids on current page and error response. Now I use javascript to put all the error response into a iframe. It works well.

Thanks again!
James
Reply | Threaded
Open this post in threaded view
|

Re: Re: Display event body in xforms-submit-error

vernekap
Hi James

I want to locate field which has thrown xforms-submit-error during submission. Can you elaborate on your solution?

with regards
Pralhad


JamesGu wrote
Erik,

Thank you for your help.
I debugged in javascript and found there are same ids on current page and error response. Now I use javascript to put all the error response into a iframe. It works well.

Thanks again!
James
Reply | Threaded
Open this post in threaded view
|

Re: Re: Display event body in xforms-submit-error

James Gu

The basic idea:
1. set the event body to an instance,
2. use javascript to generate a iframe page in xforms-submit-error event.

        <xforms:instance id="ERROR">
            <Error>
                 <Response/>
            </Error>
        </xforms:instance>

        <xforms:action ev:event="xforms-submit-error">
             
            <xxforms:variable name="event-body" select="event('response-body')"/>
            <xforms:setvalue ref="instance('ERROR')/Response" value="$event-body"/>
            <xxforms:script>
                var errorResponse = ORBEON.xforms.Document.getValue("response-body");
                if(document.getElementById('error-iframe')){
                    var iframeDocument = document.getElementById('error-iframe').contentWindow.document;
                    iframeDocument.open();
                    iframeDocument.write(errorResponse);
                    iframeDocument.close();
                }else{
                    alert("dynamic iframe not found");
                }
            </xxforms:script>
        </xforms:action>


        <xhtml:span  class="hidden">
            <xforms:output ref="instance('ERROR')/Response" id="response-body"/>
        </xhtml:span> 
        <xhtml:div>
             <iframe id="error-iframe" />
        </xhtml:div>




vernekap wrote
Hi James

I want to locate field which has thrown xforms-submit-error during submission. Can you elaborate on your solution?

with regards
Pralhad


JamesGu wrote
Erik,

Thank you for your help.
I debugged in javascript and found there are same ids on current page and error response. Now I use javascript to put all the error response into a iframe. It works well.

Thanks again!
James