Hi Joseph, Koen will modify WWidget::doJavaScript() to guard against this.
In general, if you use jsRef(), it's a good idea to use WWidget::doJavaScript() instead of WApplication::doJavaScript() to assure that the jsRef() will be valid at the time that the JavaScript is executed. The code executed by WWidget::doJavaScript() will execute only after the widget is rendered, and will never be executed after the widget is deleted. Another solution for you is to write a JavaScript try-catch block around your JS statement; as such the error will be silently ignored. Best regards, Wim. 2011/3/21 Joseph VanAndel <[email protected]>: > Yes, it happens with Wt 3.1.8. The problem is caused by my use of > WApplication::doJavaScript > > My application requires the user to login, and then creates various windows, > including > a log window that I want to auto-scroll as I append messages. > > Koen Deforche advised me to do the following: > ===================================================== > /* > * Little javascript trick to make sure we scroll along with new content > */ > WApplication::instance()->doJavaScript(messages_->jsRef() + ".scrollTop += " > + messages_->jsRef() + ".scrollHeight;"); > ===================================================== > > > The problem appears to be that if I destroy this window, and create another > one when the user logs in again, the javascript added with 'doJavaScript()' > is trying to reference a non-existent window. > > Having called the doJavaScript() method, is there any way to disable the > javascript that was attached to the event with doJavaScript()? > > > On Mar 21, 2011, at 9:38 AM, Koen Deforche wrote: > >> Hey Joseph, >> >> 2011/3/17 Joseph VanAndel <[email protected]>: >>> I'm getting a similar problem: >>> Wt internal error: TypeError: Result of >>> expression'$('#onft9go').get(0)'[undefined] is not an object, code: >>> undefined, description: undefined >> >> Also with an update to Wt 3.1.8 ? >> >> Any hints to what it could be related to ? >> >> Regards, >> koen >> >> ------------------------------------------------------------------------------ >> Colocation vs. Managed Hosting >> A question and answer guide to determining the best fit >> for your organization - today and in the future. >> http://p.sf.net/sfu/internap-sfd2d >> _______________________________________________ >> witty-interest mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/witty-interest > > > ------------------------------------------------------------------------------ > Enable your software for Intel(R) Active Management Technology to meet the > growing manageability and security demands of your customers. Businesses > are taking advantage of Intel(R) vPro (TM) technology - will your software > be a part of the solution? Download the Intel(R) Manageability Checker > today! http://p.sf.net/sfu/intel-dev2devmar > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
