I have the following form:
<form id="searchform_txtRepeatComplaint" name="searchform_txtRepeatComplaint">
<input name="datasource" type="hidden" value="TDA">
<input name="from" type="hidden" value="eci_data">
<input name="where" type="hidden" value="">
<input name="componentname" type="hidden" value="txtRepeatComplaint">
<input name="staticstrings" type="hidden" value="">
<input name="staticfields" type="hidden" value="">
<input class="nostyle" name="returnfield" type="hidden" value="Complaintinformation_ID">
<input class="nostyle" name="returnid" type="hidden" value="Complaintinformation_ID">
eCI ID:<input class="nostyle" type="text" name="Complaintinformation_ID" id="Complaintinformation_ID" style="width:150px;"/>
Complaint number: <input class="nostyle" type="text" name="eci_number" id="eci_number" style="width:150px;"/>
</form>
This is a form within a bigger form tag. I also have the following JS code:
var data_save = $("#searchform_txtRepeatComplaint").serializeArray();
alert(data_save);
The alert shows up empty. (not even [Object] is shown, it's just an empty alert box). What am I doing wrong?
SOLUTION for future readers: I found how to get around this error. I changed the FORM into a DIV and added the input selector, like such:
var data_save = $("#searchform_txtRepeatComplaint input").serializeArray();
ALSO: the docs state serializeArray() will not work with a form in a form (which is illegal HTML anyway)