I've created a very simple test page to replicate a problem I'm having within my application.Sorry if this looks long winded for something so trivial.
The .aspx page
<body>
<form id="form1" runat="server">
<asp:TextBox ID="tb" runat="server"></asp:TextBox>
<asp:Button ID="btnOk" runat="server" text="OK" Width="60px" UseSubmitBehavior="true" OnClientClick="saveAmendments();" />
</form>
In the page_load in the code behind I add an onchange attribute to the textbox
if (!IsPostBack)
{
tb.Attributes.Add("onchange", "addSaveDetails('abc###123###456###test###abc###');");
}
}
Which gets rendered as follows
<body>
<form name="form1" method="post" action="TestJP.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUi3er8ht8oaCZzy2..." />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKOoa..." />
</div>
<input name="tb" type="text" value="testtt" id="tb" onchange="addSaveDetails('abc###123###456###test###abc###');" />
<input type="submit" name="btnOk" value="OK" onclick="saveAmendments();" id="btnOk" style="width:60px;" />
</form>
So if i change the value in the text box and click somwhere else on the screen the AddSaveDetails function fires. Then click on the button and the saveAmendments fires. However if you change the text and then click immediately on the button (rather than somewhere else on the screen first) and only the first (onchange) function fires. The onClick event never does. The js being called does nothing other than an alert. What could be stopping the event bubbling up to the last call?