RE: [Httpunit-develop] Re: javascript syntax error with struts
Brought to you by:
russgold
From: <Eri...@al...> - 2002-10-25 18:22:06
|
Lars, HttpUnit gave me this kind of javascript problem, also. When I switched to WebUnit (http://sourceforge.net/projects/webunitproj/),=20 all this cleared up. WebUnit doesn't emulate javascript, like Rhino. Instead, it uses the javascript support that is=20 part of the browser you're using. WebUnit currently supports IE 5.5+. Netscape support is coming soon. --Erik > -----Original Message----- > From: Lars Olsson [mailto:la...@ru...] > Sent: Friday, October 25, 2002 10:32 AM > To: htt...@li... > Subject: [Httpunit-develop] Re: javascript syntax error=20 > with struts >=20 >=20 > Hi again, > Here is the function: > <script language=3Djavascript><!--=20 > function submit_nodeForm_formAction(newValue,message) {=20 > document.nodeForm.formAction.value=3DnewValue; > if ( message=3D=3D"" ) { document.nodeForm.submit(); } > else if ( confirm(message) ) {=20 > document.nodeForm.submit(); } > }; > --></script> >=20 > I actually found the problem, the function that the javascript > tries to execute in JavaScript.executeScript looks like this: >=20 > function submit_nodeForm_formAction(newValue,message) {=20 > document.nodeForm.formAction.value=3DnewValue; > if ( message=3D=3D"" ) { document.nodeForm.submit(); } > else if ( confirm(message) ) {=20 > document.nodeForm.submit(); } > }; > --> >=20 > Observe the trailing end comment (-->). This was the=20 > syntax error. So I > suppose it is some kind of bug in the parsing in=20 > httpunit, but I have not > had time yet to look at it in detail.=20 >=20 > Btw, is it possible to set the value of an field in a form > (document.nodeForm.formAction.value=3DnewValue; in the=20 > code above)? > I can't get it to work. If not, would it be easy fix? I=20 > might give it a go > this weekend or next week. >=20 > cheers, > lars >=20 >=20 > On Fri, 25 Oct 2002, Lars Olsson wrote: >=20 > > Dear all, > > I am using the httpunit prerelease=20 > httpunit-1.4.6-d-21Oct, struts 1.0, > > and the latest stable rhino javascript library. When=20 > I try to submit a > > form where the submit button is specified using the=20 > struts rs taglibrary, > > for example: > > <rs:submit name=3D"nodeForm" label=3D"Save pagedetails"=20 > value=3D"edit"/>,=20 > > I get a syntax error in the javascript parsing in=20 > httpunit(rhino) as > > follows: > > =20 > > <error message=3D"Script 'function > > submit_nodeForm_formAction(newValue,message) {=20 > > document.nodeForm.formAction.value=3DnewValue; > > if ( message=3D=3D"" ) {=20 > document.nodeForm.submit(); } > > else if ( confirm(message) ) {=20 > document.nodeForm.submit(); } > > }; > > -->' failed: SyntaxError: syntax error (httpunit; line > > 5)"=20 > type=3D"com.meterware.httpunit.ScriptException">com.meterw > are.httpunit.ScriptException: Script > > 'function submit_nodeForm_formAction(newValue,message) {=20 > > document.nodeForm.formAction.value=3DnewValue; > > if ( message=3D=3D"" ) {=20 > document.nodeForm.submit(); } > > else if ( confirm(message) ) {=20 > document.nodeForm.submit(); } > > }; > > -->' failed: SyntaxError: syntax error=20 > (httpunit; line 5) > > at > >=20 > com.meterware.httpunit.javascript.JavaScript$JavaScriptE > ngine.handleScriptException(JavaScript.java:164) > > at > >=20 > com.meterware.httpunit.javascript.JavaScript$JavaScriptE > ngine.executeScript(JavaScript.java:114) > > at > >=20 > com.meterware.httpunit.scripting.ScriptableDelegate.runS > cript(ScriptableDelegate.java:53) > > at > >=20 > com.meterware.httpunit.WebResponse$Scriptable.load(WebRe > sponse.java:576) > > at > >=20 > com.meterware.httpunit.javascript.JavaScript$Window.init > ialize(JavaScript.java:364) > > at > >=20 > com.meterware.httpunit.javascript.JavaScript.run(JavaScr > ipt.java:79) > > at > >=20 > com.meterware.httpunit.javascript.JavaScriptEngineFactor > y.associate(JavaScriptEngineFactory.java:46) > > at > >=20 > com.meterware.httpunit.FrameHolder.updateFrames(FrameHol > der.java:85) > > at > >=20 > com.meterware.httpunit.WebWindow.updateFrameContents(Web > Window.java:184) > > at > >=20 > com.meterware.httpunit.WebClient.updateFrameContents(Web > Client.java:472) > > at > >=20 > com.meterware.httpunit.WebWindow.updateWindow(WebWindow. > java:167) > > at > >=20 > com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:111) > > at > >=20 > com.meterware.httpunit.WebWindow.updateWindow(WebWindow. > java:165) > > at > >=20 > com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:111) > > at > >=20 > com.meterware.httpunit.WebClient.getResponse(WebClient.java:113) > > at > >=20 > com.RuntimeCollective.theseus.test.web.TheseusHttpTestCa > se.getResponseFromLink(TheseusHttpTestCase.java:143) > > at > >=20 > com.RuntimeCollective.theseus.test.web.ContentManagement > Test.getAddPagePage(ContentManagementTest.java:61) > > at > >=20 > com.RuntimeCollective.theseus.test.web.ContentManagement > Test.testToAddAPageWithoutContent(ContentManagementTest.java:92) > > at=20 > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > >=20 > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethod > AccessorImpl.java:39) > > at > >=20 > sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegati > ngMethodAccessorImpl.java:25) > > </error> > >=20 > >=20 > > Any ideas how I can solve this problem? > >=20 > > thanks alot, > > lars > >=20 > >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future=20 > of Java(TM) technology. Join the Java Community=20 > Process(SM) (JCP(SM)) program now.=20 > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > Httpunit-develop mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httpunit-develop >=20 |