I am using node.js with mongodb have a <select><option> Box holding values,
Each value will be entered in to the DB if it is selected.
First-
Second-
Third-
If First- is selected I want it to be entered to the DB as First-1
If First has one entry in the DB I want the second entry to be entered to the DB as First-2
and so on.
I can not come up with a good plan on how to achieve this.
Any ideas?
Here is my function filling the select option box
// Fill Combobox with items in the array
function populateCombo() {
var combo = '';
var comboContent = new Array('<option value="" disabled selected>Select Type', '<option value="LP-Bom">Bombardier', '<option value="LP-Gul">Gulfstream', '<option value="LP-Pil">Pilatus');
$.each(comboContent, function( index, value){
combo += value + '</option>';
});
// Inject the whole content string into our existing HTML table
$('#manuType').html(combo);
};
Here is my function entering data to the database
// Gather new data to be entered to DB
var newDrawing = {
'lpNumber': $('#addDrawing fieldset select#manuType').val()
}
What is the best way to attach a int value to the end of each entry to the DB