You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kent Tong <ke...@cpttm.org.mo> on 2005/03/15 04:04:00 UTC

HttpUnit can't test javascript validation handler

Hi,

I've been trying to test a Tapestry page using javascript
validation with HttpUnit and found a problem: HttpUnit
won't trigger the form's onsubmit Javascript handler.

After quite some research I found that it is because
the onsubmit handler is assigned as an initialization
script which is added to the Body component and the
Body will generate code like:

<body>
<script>
window.onload = function () {
	script1; (eg, document.form0.onsubmit=validate)
	script2;
	script3;
}
</script>
</body>

Instead of:

<body onload="script1;script2;script3">
</body>

And for some reason HttpUnit doesn't seem to support
window.onload (although it claims it does). It does
support the onload attribute of the body element. That
is, the latter works with HttpUnit but the former
doesn't.

So, my question is, is there any reason why we can't
let the Body generate code like:

<body onload="init$0()">
<script>
function init$0() {
	script1;
	script2;
	script3;
}
</script>
</body>

If there is no reason this won't work, maybe I can
submit a patch or just make a HttpUnitFriendlyBody
component by copying Body.

Thanks!

-- 
Kent Tong, Msc, MCSE, SCJP, CCSA, Delphi Certified
Manager of IT Dept, CPTTM
Authorized training for Borland, Cisco, Microsoft, Oracle, RedFlag & RedHat


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org