My site is being used as a help desk. There are a couple of mandatory fields at the top that never change. Then there are two drop downs below. The first determines what options are in the second one, and the second one determines all the fields below that can be filled in. I have this all working. However if I add a button to the bottom, I don't know how to get all the texts out of the fields. The bottom fields show up using some switch statements and JavaScript making the div visible.
Here is an example div:
<div id="third_form_three" class="third_hidden" style="display:none;">
<label id="company_label" class="stdFormLabel">
Which Company:
</label>
<select id="company_select">
<option value="apple">Apple</option>
<option value="pear">Pear</option>
<option value="banana">Banana</option>
</select><br>
Sales Org: <input type="text" name="sales_org" required><br>
Sales Office: <input type="text" name="office" required><br>
Sales Group: <input type="text" name="group" required><br>
Customer Group: <input type="text" name="customer" required><br>
Sales District, if applicable: <input type="text" name="dist"><br>
<!-- ABILITY TO ATTACH A DOCUMENT -->
<telerik:RadUpload ID="upl_cfsAttachment_four_one" ControlObjectsVisibility="None" InitialFileInputsCount="1" InputSize="40" runat="server" MaxFileInputsCount="1" required />
</div>
I believe my required
's maybe wrong, but I'm not worried about that at the moment. Here is the start of my JavaScript
function cfsButtonClick() {
var array = [];
var inputs = [];
inputs.push(jQuery('.third_hidden:visible').contents().find('input'));
inputs.each(function () {
if (jQuery(this).val() != "")
array.push(jQuery(this).val());
});
alert(array[0]);
alert(array.length);
}
Any suggestions? I am just having a hard time getting all the input out without writing a monster switch statement with all unique id's. To put this in perspective my first drop down has 5 options and my second one has on average 6. So there is ~30 divs like my example and they are all mostly unique.