[Httpunit-develop] I:Newbie: Problem Submitting a Form with action as Javascript
Brought to you by:
russgold
|
From: MURALIDHARAN C. <MUR...@se...> - 2003-03-28 08:40:39
|
> >What does the checkValue() function look like? It appears that Rhino
> cannot=20
> >compile it.=20
>=20
> Thanks for the response...This is the code snippet. (I sent this =
message
> previously, but with a wrong subject, Sorry)
>=20
> function checkValue()
> {
> if( document.search.ACCOUNT_NUMBER.value !=3D "" )
> {
> document.search["SearchNDG"].focus();
> document.search.action =3D "/routerservlet?event_SearchNDG";
> document.search["SearchNDG"].click();
> }
> else if( document.search.ACCOUNT_LINKER.value !=3D "")
> {
> document.search["SearchNDGLink"].focus();
> document.search.action =3D "/routerservlet?event_SearchNDGLink";
> document.search["SearchNDGLink"].click();
> }
> }
>=20
> Code got nothing complicated, and works as expected in browser (IE =
6).
>=20
> I tried this testing code...
>=20
> .....
>=20
> // Retrieve Scriptable reference from form
> WebForm.Scriptable scriptable =3D form.getScriptableObject();
> // fill parameter
> scriptable.setParameterValue("ACCOUNT_NUMBER", "16927706");
> // change form action
> logger.info("BEFORE CHANGE: This form is going to: " +
> scriptable.getAction());
> scriptable.setAction("/routerservlet?event_SearchNDG");
> logger.info("This form will now goto: " + scriptable.getAction());
> // execute request using default submit button
> response =3D form.submit(form.getSubmitButtons()[0]);
> ....
>=20
> Here, I actually modified the form's action to use the direct servlet =
link
> instead of the Javascript, because in this flow intended to test =
here, I
> know the decision the script will take based on the input. I observed =
that
> page didn't proceed....After form.submit also the response contained =
the
> same page.
>=20
> Thanks and Regards
> Murali
>=20
>=20
> ----------
> Da: MURALIDHARAN C.
> Inviato: mercoled=EC 26 marzo 2003 18.02
> A: 'htt...@li...'
> Oggetto: Newbie: Problem Submitting a Form with action as Javascript
>=20
> Hi Everyone,
>=20
> I'm totally new to HTTPUnit, and I'm trying to develop HTTPUnit tests =
for
> my (heavy) JSP application.
>=20
> There's a situation where I have this kind of form:
>=20
> <form name=3D"search" action=3D"javascript:checkValue()" =
method=3Dpost>
> <table ....>
> ...
> <input type=3D"Submit" name=3D"Search" value=3D"Search">
> ...
> </form>
>=20
> The script checkValue goes like this:
>=20
> <script language=3Djavascript>
> function checkValue()
> {
> if (document.search..........)
> }
> </script>
>=20
> and is placed well within the same HTML file.
>=20
> During submission of this form, Rhino always throws this exception:
> "TypeError: undefined is not a function"
>=20
> com.meterware.httpunit.ScriptException: URL 'javascript:checkValue()'
> failed: TypeError: undefined is not a function. (httpunit; line 22)
> at
> =
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScri=
pt
> Exception(JavaScript.java:185)
>=20
> Any suggestions as to what may be the problem here? Since I'm new to
> HTTPUnit/Rhino I'm not familiar with the framework's code...
>=20
> Thanks and Regards
> Murali
>=20
>=20
>=20
>=20
>=20
Questo documento e gli eventuali allegati sono indirizzati unicamente =
al
destinatario, a cui la lettura e l'utilizzo delle informazioni =
contenute
sono esclusivamente riservati. Nel caso di utilizzo non autorizzato, =
Banca
Sella potra' dar corso alle azioni piu' opportune per il risarcimento =
dei
danni subiti anche da terzi. Nell'ipotesi che la e-mail non fosse
indirizzata a Voi o il contenuto lasci intendere che possano esservi =
stati
errori o manipolazioni nella trasmissione, vogliate cortesemente =
contattare
i seguenti indirizzi di posta elettronica: in...@se...; =
re...@se...=20
This e-mail is directed uniquely to the interested party, which is the
exclusive addressee of any information contained herein. For any abuse =
about
the content of this message, Banca Sella will claim compensation for =
damages
occurred to third parties as well. In case the e-mail should be =
addressed to
other than you, or the content should reveal any transmission errors or
manipulations, please contact us at the following address: =
in...@se...;
re...@se...
|