2 messages in com.canoo.lists.webtest[Webtest] onclick event handler on ch...| From | Sent On | Attachments |
|---|---|---|
| vikr...@mastek.com | 05 May 2005 02:10 | |
| Marc Guillemot | 05 May 2005 02:30 |
| Subject: | [Webtest] onclick event handler on checkbox.![]() |
|---|---|
| From: | vikr...@mastek.com (vikr...@mastek.com) |
| Date: | 05/05/2005 02:10:21 AM |
| List: | com.canoo.lists.webtest |
Hi,
When we set the value of the checkbox the onclick event handler is not invoked.
We have a web page on which there is checkbox present the code for the checkbox is somewhat like this.
<input type="checkbox" name="isEmpAdsEqual" value="on" onclick="javascript:fnSameAsLegalAdd()">
And the webtest script is
<setcheckbox name=" isEmpAdsEqual" value="on" />
When we run the webtest script the onclick event handler on this checkbox is not getting called. As a result of which the further verifications fail, as there are some hidden fields that are set in the JavaScript function.
The HTMLUnit source for the HtmlCheckBoxInput element mentioned "Both IE and Mozilla will first update the internal state of checkbox and then handle "onclick" event". Due to this comment, following code changes were done to com.canoo.webtest.steps.form.SetCheckbox class in the doExceute method.
Previous Code...
boolean checked = isChecked();
checkBox.setChecked(checked);
New code....
boolean checked = isChecked();
// If original value is same as what is being set then do nothing.
// Otherwise call the click method which will toggle the check box state
// and also call onclick event handler.
if(checkBox.isAttributeDefined("checked") != checked)
{
checkBox.click();
//checkBox.setChecked(checked);
}
With the new code the onclick event gets called and everything works smoothly. Mind you if we have the onchange event handler on the checkbox, it still does not get called though!!!
I am not sure whether the fix that I have done is the right place to do this fix for this issue. If anyone can throw some light on this it will be great :-).
Thanks & Regards Vikram Shitole Mastek Ltd Phone No : 56072000/ 56072100 extn 2131 Mastek on the web: <http://www.mastek.com/> www.mastek.com
"No one knows what he can do till he tries."
MASTEK "Making a valuable difference" Mastek in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of
Mastek Limited, unless specifically indicated to that effect. Mastek Limited
does not accept any responsibility or liability for it. This e-mail and
attachments (if any) transmitted with it are confidential and/or privileged and
solely for the use of the intended person or entity to which it is addressed.
Any review, re-transmission, dissemination or other use of or taking of any
action in reliance upon this information by persons or entities other than the
intended recipient is prohibited. This e-mail and its attachments have been
scanned for the presence of computer viruses. It is the responsibility of the
recipient to run the virus check on e-mails and attachments before opening them.
If you have received this e-mail in error, kindly delete this e-mail from all
computers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




