onchange event is not fired for select element

Dec 12, 2012 at 6:16 PM

Hi,

I have several elements similar to this this:

<select name="name" tabIndex="25" id="ID" onchange="SetListValue(this, 'card_cardType')">

When CUITe selects the item and changes the value, the onchange event associated with this item is not being fired. This is causing validation problems on my page.

Is there a way to force this event to be run?

-Dennis

Coordinator
Jan 17, 2013 at 7:43 AM

Hi Dennis,

Can you provide sample code that can reproduce the issue please?

For example, what method(s) are you using to select the item?

Thank you.

Jan 17, 2013 at 1:43 PM

I've worked around the problem. I think this issue is specific to the code and isn't something coming from CUITe. To workaround the problem, I just update the fields twice, that seems to ensure that the code gets validated. It doesn't take much longer so it doesn't bother me that I have to do that.

Unfortunately, I can't provide sample code to reproduce the problem for this scenario.

Coordinator
Jan 19, 2013 at 7:13 PM

I could not reproduce this issue.

It may be an error with your HTML\JavaScript syntax.

For example, the code in your onchange event handler does not end with a semicolon.

Here is a sample unit test that works without issues:

<select id="selectAndAlertOnChange" onchange="alert('onchange');">
    <option>Apple</option>
    <option>Banana</option>
    <option>Carrot</option>
</select>
        [TestMethod]
        public void SelectItem_UsingHtmlComboBoxThatAlertsOnChange_Succeeds()
        {
            CUITe_BrowserWindow bWin = CUITe_BrowserWindow.Launch(CurrentDirectory + "/TestHtmlPage.html", "A Test");
            CUITe_HtmlComboBox cmb = bWin.Get<CUITe_HtmlComboBox>("Id=selectAndAlertOnChange");
            cmb.SelectItem("Banana");

            bWin.PerformDialogAction(BrowserDialogAction.Ok);

            bWin.Close();
        }