[Webtest] [webtest][JIRA] Created: (WT-143) onchange of a selectbox fires twice

Niko (JIRA) webtest@lists.canoo.com
Tue, 24 Jan 2006 13:47:27 +0100 (CET)


onchange of a selectbox fires twice
-----------------------------------

         Key: WT-143
         URL: http://webtest-community.canoo.com/jira/browse/WT-143
     Project: WebTest
        Type: Bug
    Versions: 1.7    
 Environment: WebTest R_1145, Ant 1.6.5, Eclipse 3.1.0, Windows-XP
    Reporter: Niko


Hi,

I'm using WebTest R_1145 and noticed a strange behaviour.
I have got a website like this:
<html>
<head>
<script type="text/javascript">
      function refresh(value) {
        self.document.getElementById("myEvent").value = value;
        self.document.getElementById("myEvent").name = "event";
	self.document.getElementById("test").value = (self.document.getElementById("test").value + 1);
	self.document.forms[0].submit();
      }
</script>
</head>
<body>
<form name="awsplan_webclient" method="post" action="/MyServlet">
	<input type="hidden" id="myEvent" name="externalEvent" value="">
	<input type="hidden" id="test" name="test" value="">
<table>
<tr>
<td align="right" class="standardWidthLeft">* Loginname :</td>
<td colspan="2"><select name="selectedUserLoginName" onchange="javascript:refresh('refreshUser');" class="name"><option value="admin">admin</option>
<option value="j">j</option>
<option value="manager">manager</option>
<option value="new">new</option>
<option value="reader" selected>reader</option></select>
</td>
</tr>	
</table>
</form>
</body>
</html>

The steps for WebTest are the following ones:
<invoke description="goto start page" url="https://localhost:8443/test.htm" />
<setSelectField description="choose new user" name="selectedUserLoginName" value="manager"/>

The form should be submitted with reader as value of the attribute selectedUserLoginName. But the form is submitted twice. The first request contains the value admin and the second one contains the expected value reader.
I added the field "test" to check if the function is called twice on this site. Indeed in the first request the value of test is "1" and in the second one it's "11". So the function is called twice but if I try this in my browser (IE or Firefox) I get only one request.
This happens only if one of the options has got the attribute "selected".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira