I did my test with latest JWebUnit (1.5). Remember that HttpUnit doesn't 
support JavaScript very well.

Regards,

Julien



----- Message d'origine ----
De : "Saavedra, Gisella" <[EMAIL PROTECTED]>
À : Usage problems for JWebUnit <jwebunit-users@lists.sourceforge.net>
Envoyé le : Vendredi, 1 Août 2008, 17h45mn 58s
Objet : Re: [JWebUnit-users] Re : form onsubmit is not executed by jwebunit

 
Julien,
 
I have an old version of
jwebunit, 1.2.  This version does not use HTMLUnuit but HTTPUnit.
 
What version have you used, 1.5?

Thanks,
 
gs
 
From:[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Julien
HENRY
Sent: Thursday, July 31, 2008 12:37 AM
To: Usage problems for JWebUnit
Subject: [JWebUnit-users] Re : form onsubmit is not executed by jwebunit
 
Works for me (TM)

form.html :

<html>
<head>
<script type="text/javascript">
function changeQuickSearchAction(theForm) {
      theForm.action ="ok.html";
}
</script>
</head>
<body>
<form name="crudForm" method="get"
action="ko.html" onsubmit="changeQuickSearchAction(this);return
true;">
<input type="submit"/>
</form>
</body>
</html>

ok.html :

<html>
<head>
  <title>OK</title>
</head>
<body>
</body>
</html>


AppTest.java :

public class AppTest extends WebTestCase
{

    public void testApp()
    {
        URL url =
this.getClass().getResource("/form.html");
        beginAt(url.toExternalForm());
        submit();
        assertTitleEquals("OK");
        setScriptingEnabled(false);
        beginAt(url.toExternalForm());
        submit();
        assertTitleEquals("KO");
    }
}


 
----- Message d'origine ----
De : "Saavedra, Gisella" <[EMAIL PROTECTED]>
À : jwebunit-users@lists.sourceforge.net
Envoyé le : Mercredi, 30 Juillet 2008, 23h16mn 12s
Objet : [JWebUnit-users] form onsubmit is not executed by jwebunit
I have the following form
<form
name="crudForm" method="post"
action="/trips/searchLoads.do" onsubmit="changeQuickSearchAction(this);return
true;">
 
..
</form>
 
with the
javascript code:
 
function changeQuickSearchAction(theForm) {
  
      var theSelect = document.getElementById("searchType");
      var theSelectValue = theSelect.options[theSelect.selectedIndex].value; 
      if (theSelectValue == "equipmentId") {
        theForm.action ="/trips/searchEquipments.do";
      } else {
        theForm.action= "/trips/searchLoads.do";
      }
  }
 
 
 
 
The
script does not seem to be executed.
 
Any
help, I will appreciate it?
 
gs
 
 

________________________________
 
Envoyé
avec Yahoo!
Mail.
Une boite mail plus intelligente. 


      
_____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to