I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to get anything to happen. Below is the code. Thanks in advance.
jQuery:
.ASPX Main Page
.cs code for main page builds table above adding links that jQuery attaches click events to. The links look something like this:
<a id="form999999 " href="SubForms/Order_02_Form_0 1.aspx?lineNumb er=999999">Serv ice Description</a>
.ASPX Form code
.cs code mainly just generates the options for the dropdown list.
jQuery:
Code:
jQuery(document).ready(function()
{
jQuery("a[@id*=form]").click(function()
{
jQuery("#dialog").dialog({
modal: true,
autoOpen: false,
width: 600,
dialogClass: "flora",
overlay: {opacity: 0.5, background: "black"}
});
jQuery("#dialog").load(jQuery(this).attr("href") + " form[@id*=order] fieldset",setFormClick());
jQuery("#dialog").dialog("open");
return false;
});
function setFormClick()
{
jQuery('#dialog input[@id*=update]').click(function()
{
alert("It works");
});
}
}
Code:
<%@ Page Language="C#" AutoEventWireUp=true CodeFile="Order_02_ServiceAdmin.aspx.cs" Inherits="_Default" %>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="/custom/applications/appStyles.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" href="/custom/applications/jquery.ui-1.5/themes/flora/flora.dialog.css" type="text/css" media="screen" />
<script type="text/javascript" src="/custom/applications/jquery.ui-1.5/jquery-1.2.6.js"></script>
<script type="text/javascript" src="/custom/applications/jquery.ui-1.5/ui/ui.core.js"></script>
<script type="text/javascript" src="/custom/applications/jquery.ui-1.5/ui/ui.dialog.js"></script>
<script type="text/javascript" src="javascript/Order_02_functions.js"></script>
</head>
<body>
<form id="Order_02" runat="server">
<div id="dialog"></div><!--Form inserted here-->
<!--Irrelevant code here-->
<div style="float: left; width: 40%; height: 100%;">
<fieldset style="overflow: auto">
<legend>Selected Services</legend>
<asp:table ID="servicesSelected" runat="server" Caption="No Services Selected" EnableViewState="false">
<asp:tableheaderrow CssClass="eth">
<asp:tableheadercell>
Service (Click to input details)
</asp:tableheadercell>
<asp:tableheadercell>
</asp:tableheadercell>
<asp:tableheadercell>
Status
</asp:tableheadercell>
<asp:tableheadercell>
Notes
</asp:tableheadercell>
</asp:tableheaderrow>
</asp:table>
</fieldset>
</div>
<!--Irrelevant code here-->
</form>
</body>
</html>
<a id="form999999 " href="SubForms/Order_02_Form_0 1.aspx?lineNumb er=999999">Serv ice Description</a>
.ASPX Form code
Code:
<%@ Page Language="C#" AutoEventWireUp=true CodeFile="Order_02b_Form_01.aspx.cs" Inherits="_Default" %>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="/custom/applications/appStyles.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<form id="order01" runat="server">
<fieldset id="01" class="generalFieldsetStyle">
<legend></legend>
<p>
<label for="t01_COUNTY"><span class="importantText" >*</span>County: </label>
<asp:textbox ID="t01_COUNTY" runat="server" MaxLength="30"/><span id="reqCounty" style="color: red; visibility: hidden">Please enter the name of the county</span><br/>
<label for="t01_STATE_PROVINCE">
<span class="importantText">*</span>State:
</label>
<asp:dropdownlist id="t01_STATE_PROVINCE" runat="server">
<asp:listitem value="" Text=""></asp:listitem>
<asp:listitem value="NY" Text="NY"></asp:listitem>
</asp:dropdownlist>
<span id="reqState" style="color: red; visibility: hidden">Please select a state</span><br/>
<input id="update01" name="update01" type="button" value="Update" />
</p>
</fieldset>
</form>
</body>
</html>
Comment