Welcome Guest, Not a member yet? Register   Sign In
jquery drag and drop

ok, with some playing around, and some net-friends, this is the full working code for anyone who is still interested or might find this in the future.

a big thanks to the OP for the initial code, and the others who participated here.

Ps watch out the 's_cript' that need to be fixed...

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
&lt;html &gt;
    &lt;meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /&gt;
    &lt;title&gt;IT Project Guide Risk Place&lt;/title&gt;

  &lt;link rel="stylesheet" type="text/css" href="http://itprojectguide.org/PMBase/RiskPlace/demo/css/main.css"&gt;
  <s_cript type='text/javas_cript' src="http://itprojectguide.org/PMBase/RiskPlace/demo/js/jquery.js"></s_cript>
  <s_cript type='text/javas_cript' src="http://itprojectguide.org/PMBase/RiskPlace/demo/js/jqcode.js"></s_cript>
  <s_cript type='text/javas_cript' src="http://itprojectguide.org/PMBase/RiskPlace/demo/js/ui.core.js"></s_cript>
  <s_cript type='text/javas_cript' src="http://itprojectguide.org/PMBase/RiskPlace/demo/js/ui.draggable.js"></s_cript>
  <s_cript type='text/javas_cript' src="http://itprojectguide.org/PMBase/RiskPlace/demo/js/ui.droppable.js"></s_cript>

$(document).ready(function() {
// note that you have to add a button with a class of "save-risks"
$("button.save-risks").click(function() {
    var riskLevels = ['unassigned','lowrisk','medrisk','highrisk'];
    // dynamically create a new form
    var form = document.createElement('form');
    form.style.display = 'none';
    form.method = 'post';
    form.action = 'write.asp' // whatever you want the form to submit to...
    // populate our new form with data
    for(var i = 0; i < riskLevels.length; i++) {
        var riskLevel = riskLevels[i];
        var selector = '.'+riskLevel+' div.dragdrop';
     //  $(selector).each(function(el) {
        $(selector).each(function(i,el) {

            var input = document.createElement('input');
            input.name = riskLevel+'-entries[]';
            var myValue =  el[removed]; //innerText might be a better idea //innerHTML
            input.value = myValue;


    <div class="unassigned-container">
        Unassigned Risks
        <div class="unassigned">
            <div class="dragdrop">incomplete requirements</div>
            <div class="dragdrop">late server delivery</div>

    <div class="list-container">
        <div class="lowrisk-container">
            Low Risk List
            <div class="lowrisk">
                <div class="dragdrop">sponsor support</div>
                <div class="dragdrop">subject matter expert availability</div>

        <div class="medrisk-container">
            Medium Risk List
            <div class="medrisk">
                <div class="dragdrop">performance</div>
                <div class="dragdrop">server admin support</div>

        <div class="highrisk-container">
            High Risk List
            <div class="highrisk">
                <div class="dragdrop">resource priority setting</div>
                <div class="dragdrop">team communication</div>
    <div class="newrisk-container">
        New Risk Entry
        <div class="newrisk">
        Enter new risk:        
        &lt;input class="newrisk" type="text" value=""&gt;
        <button class="add-newrisk">Add</button>
    </div>    </div>  
    <div class="message">
        Message: enter a new risk or drag/drop an existing risk to one of the Risk Areas
<button class="save-risks">Add</button>


Theme © iAndrew 2016 - Forum software by © MyBB