included javascript files
"Jakub Światły" <[email protected]> Fri, 20 Jun 2008 12:02:19 +0200
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm writing tests of JSP based application using HttpUnit 1.7.
Everything works fine untill i try i to run javascript that uses
functions defined in external .js file. There are no linkage errors,
looks like the function was found but it is not called and it returns
with null (i think). Can anyone tell me how to solve this? I can
provide any details you want.
Thanks in advance for your help.
Kuba Światły
example:
.jsp file:
<script src="/docusafe/functions.js"></script>
(...)
<script language="JavaScript">
function submitPerson()
{
(...)
person.location = id('location').value;
person.country = getSelectedOption(id('country')).value;
person.email = id('email').value;
return true;
}
function id(id)
{
return document.getElementById(id);
}
</script>
(...)
<input type="button" value="Umieść w formularzu" onclick="if
(!submitPerson()) return false; window.close();" class="btn"/>
where function getSelectedOption() is defined in file functions.js:
function getSelectedOption(sel)
{
return sel.options[sel.options.selectedIndex];
}
when I call click() on the button I get:
org.mozilla.javascript.EcmaError: TypeError: Cannot read property
"value" from undefined (httpunit#28)
I've traced execution and this exception is thrown while interpreting
line: person.country = getSelectedOption(id('country')).value;
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php