[jQuery] Dynamic checkbox not included in submit by jquery.form
Hello,
I have a form with a drop down list which populates a div with checkboxes based on an AJAX query each time it changes.
I'm then using ajaxSubmit to post that data along with a few additional form elements. All of the elements are included in the post <u>except for the checkboxes</u>.
HTML and code snippets are listed below... the checkboxes are populated in div#account.
Any suggestions?
thanks,
Michael
<u><b>HTML</b></u>
<form id="frmAdd" action="createHold.rails" method="post">
<table align="center">
<tr>
<td>
<label for="manager">Manager</label>
<select id="manager" name="manager" ></select>
</td>
<td>
<label for="account">Account</label>
<div id="account" ></div>
</td>
</tr>
</table>
<br />
<div align="center" id="details">
<fieldset id="HoldContainer">
<legend><strong>Hold Details</strong></legend>
<ul id="HoldDetailsList">
<li><strong>Start Date</strong></li>
<li><input type="text" id="StartDate" name="StartDate" class="calendar" maxlength="35" style="width:75;" /></li>
<li><strong>End Date (optional)</strong></li>
<li><input type="text" id="EndDate" name="EndDate" class="calendar" maxlength="35" style="width:75;" /></li>
<li><strong>Comments</strong></li>
<li><textarea id="Comments" name="Comments" cols="52" rows="4" ></textarea></li>
</ul>
<input type="submit" id="submit" name="submit" value="Submit" />
</fieldset>
</div>
</form>
<u><b>JS attached to manager.click</b></u>
function updateAccounts() {
$.getJSON("getAccounts.rails",
{
ShowAllAccounts:$('#showAllAccounts:checked').val() == null ? "false" : "true",
pmidz:pmid,
q: $('select#manager').selectedValues()[0]
}
,function(j) {
var options = '<ul style="list-style-type:none; text-align:left;" >';
for(var i = 0; i < j.length; i++) {
options += '<li><input type="checkbox" class="accounts" id="' + j[i].oV + '" /><strong>' +j[i].oT + '</strong></li>'
}
options += '</ul>';
$('#account').html(options).show();
$("label[@for='account']").show();
showMessage("Account List Updated Successfully");
});
}