There is a field that the user can fill in by dragging the names into it:
<form name="myForm"> <div class="procLeader"> <label>Leader:</label> <ol> <li class="placeholder"><div class="adding">Drop Here</div></li> </ol> </div> </form> As well as a function with which I save the data:
var LISTOBJ = { saveList: function() { $(".procLeader").each(function() { var listCSV = []; $(this).find("li").each(function() { listCSV.push($(this).text()); }); var values = '' + listCSV.join(', ') + ''; $(".output").append("<input type='text' name='procLeader[]' value='" + values + "' />"); $("#output").append("<p>" + values + "</p>"); console.debug(listCSV); }); } } I want to check the field before saving the form:
var procLeader = document.forms["myForm"]["procLeader[]"].value; if (procLeader == null || procLeader == "" || procLeader == "Drop Here") { alert("Please fill Process Leader Field"); return false; } But the problem is that I get a message even when the field is not empty. An example of drag and drop can be found here . thank