I am trying to determine the size of a dynamic unordered list via req.body in expressJS version 4. Here is my code:
HTML:
<button type="button" onclick="add_list_items();">Add field</button>
<div id="fields_container">
<ol id="fields_list" name="fields_list" reversed>
</ol>
</div>
JQuery: Something along these lines.
function add_list_item(){
// 1. Get the value of list item from a arbitrary text field
// 2. Construct the list item dynamically where name of the list item would be length
// of fields_list(eg: field_list0,field_list1 etc) and value would be from the
// arbitrary text field
// 3. append it to unordered list item "fields_list"
}
Now when I submit form in expressJS, I see only:
req.body.field_list0,
req.body.field_list1
I never see req.body.fields_list. Since the list is dynamic, I was not able to determine the size of the unordered list. Storing a hidden field in the webpage with the list size did not help either because req.body in expressJS does not contain hidden fields. Tried it once, did not work. Was confirmed the same by question.
Any thoughts on solving this issue?
Thanks for your help.