clemieux - 2005-06-16

Hi all,

I'm relatively new to HttpUnit, so bear with me if the answer to this is obvious.

I've seen that a select few events tied to objects in a form are handled by HttpUnit, in particular the "onchange" event for a select (dropdown) item.  However, when I enforce a change in the select item via HttpUnit (webForm.setParameter("selectedItem","item_0");) where 'selectedItem' is the name of the dropdown list, the javascript tied to its onchange event isn't running:

Here's the HTML for that dropdown:

"<select name="selectedItem" onchange="enableObject('printButton');
                                         focusObject('scannedBarcode[0]')"
        class="dropDown" id="thisPrintAreas">
<option value="Select Type ...">Select Type ...</option>
<option value="item_0">item_0</option>
<option value="item_1">item_1</option>
<option value="item_2">item_2</option>
<option value="item_3">item_3</option></select>"

The key here is the "enableObject('printButton')" function call.  It's not running because when I attempt the following:

SubmitButton submitButton = barcodePrintWebForm.getSubmitButtonWithID("printButton");
barcodePrintWebForm.submit(submitButton);

I get the following error:

"The specified button (name='PrintButton' value='' is disabled and may not be used to submit this form."

Oddly, if I run the following:

logger.debug("printButton disabled: " +submitButton.isDisabled());

I get:

"printButton disabled: false"

Does this not seem counterintuitive?  If the 'isDisabled' call states that its disabled status is false, then why cannot I not perform a submit() on it?

Just fyi, I have been able to successfully 'submit()' in other pages, and invoke any associated onclick() javascript...just don't know why I can't get this working.

The following is the HTML behind the printButton:

"<input type="image" name="PrintButton" src="/JlimsWebApp/images/print_small_button_false.jpg" onclick="javascript:operation.value='PrintLabels';
                                                     window.opener.statusObj.value = 'success';
                                                     disableObject('printButton');
                                                     disableObject('backButton');
                                                     disableObject('clearButton');
                                                     disableObject('commitButton');
                                                     submit()" onmouseover="MM_swapImage('PrintButton','','/JlimsWebApp/images/print_small_button_true.jpg',1)" onmouseout="MM_swapImgRestore()" onblur="MM_swapImgRestore()" onfocus="MM_swapImage('BarcodesButton','','/JlimsWebApp/images/print_small_button_true.jpg',1)" id="printButton">"