Ignacio & Samuel,
This kind of things do happen with the way ND4 event model works. (Still a
little mysterious to me. Haven't seen a documentation that says it all). If
you do:
=====================
CSpHtml.reset();
load(someOtherPage);
return false;
=====================
you are guaranteed to get the result you expect only if you trigger this
piece of code from an event of the Page itself.
So the solution :
Assuming your current page is pgMain,
Inside the Data Object, set a flag of the page:
======================================================================
public int this_onAfterExecuteEvent(CSpDataObjectEvent event)
{
----
----
if(errorCode!=0)
{
CSpHtml.reset();
((pgMain)CSpider.getPage("pgMain")).loadErrorPage = true;
//loadErrorPage is an instance boolean of pgMain, inited to
false in this_onBeforeDisplay() of pgMain
return (STOP);
}
}
====================================================================
Inside the pgMain do the actual stuff:
public int this_onBeforeHtmlOutput(.. ) {
if (loadErrorPage) {
CSpHtml.reset();
CSpPage pg = CSpider.getPage("pgDOError");
pg.setDisplayFieldValue("txtErrorCode", new
CSpInteger (errorCode));
pg.load( false);
return (STOP);
}
}
====================================================================
If the page has other 'heavy' elements that follows our element in the page,
you could save some processing time by checking for this flag and bypassing
the operation in the onBeforeDisplayEvent() of those heavy elements.
Regards,
Aby
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, May 03, 1999 11:37 AM
> To: [EMAIL PROTECTED]
> Subject: [ND] Managing Data Object Errors
>
> We have a data object binded to a text field in a page and we can't catch
> the Error Code to display it in an especific error page. This is our code:
>
> We use onAfterExecuteEvent(CSpDataObjectEvent event) of the DO
>
> public int this_onAfterExecuteEvent(CSpDataObjectEvent event)
> {
> int command=PROCEED;
>
> CSpDataObject dob = (CSpDataObject) event.getSource();
>
> int errorCode = dob.getErrorCode();
> myUtil.debug("Error Code:"+errorCode);
> if(errorCode!=0)
> {
> CSpHtml.reset();
> CSpPage pg = CSpider.getPage("pgDOError");
> pg.setDisplayFieldValue("txtErrorCode", new CSpInteger
> (errorCode));
>
> command = CSpPage.load("pgDOError", false);
> return (STOP);
> }
> else
> {
> return(command);
> }
> }
>
> The page error appears to be ok, but there is some information of the next
> real page that are still there.
>
> What are we doing wrong?
> Thank you all,
>
> Ignacio and Samuel
> _________________________________________________________________________
>
> For help in using, subscribing, and unsubscribing to the discussion
> forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
> For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]