turtle Posted September 22, 2008 Share Posted September 22, 2008 I'm a XHTML and CSS veteran, but I'm new to ASP. I've inhertied a project where I need to add some code that triggers when the submit button of a form is clicked. The code for this button is: <asp:Button ID="btnShortContact" runat="server" Text="Submit" ValidationGroup="vgShortContact" onclick="btnShortContact_Click1"/> The output reads: <input type="submit" name="ctl00$shortcontact1$btnShortContact" value="Submit" onclick="java script:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$shortcontact1$btnShortContact", "", true, "vgShortContact", "", false, false))" id="ctl00_shortcontact1_btnShortContact" /> I would like the output to be something like: <input type="submit" name="ctl00$shortcontact1$btnShortContact" value="Submit" onclick="java script:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$shortcontact1$btnShortContact", "", true, "vgShortContact", "", false, false)); EXTRA CODE GOES HERE;" id="ctl00_shortcontact1_btnShortContact" /> I hope I haven't been too vague. Thank you. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 22, 2008 Share Posted September 22, 2008 I don't think you have any control over the HTML output, you need to put your extra code in the handler for that form. Link to comment Share on other sites More sharing options...
jesh Posted September 23, 2008 Share Posted September 23, 2008 What do you want that extra script to do? The WebForm_DoPostBackWithOptions function already calls the submit() method for your form.If you want to add some javascript that runs when the form is submitted, you can try adding it to the form element:ASPX <form id="myForm" runat="server" onsubmit="alert('this will alert when the form is submitted');"> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.