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

[eluser]Nick Husher[/eluser]
I'm only a novice at jQuery, but I think something along these lines would work:

Code:
// 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 = '.' // whatever you want the form to submit to...
    document.body.appendChild(form);
    
    // populate our new form with data
    for(var i = 0; i < riskLevels.length; i++) {
        var riskLevel = riskLevels[i];
        var selector = '.'+riskLevel+' .ui-draggable';
        
        $(selector).each(function(el) {
            var input = document.createElement('input');
            input.name = riskLevel+'-entries[]';
            input.value = el.inner HTML; //innerText might be a better idea
        });        
    }
    
    form.submit();
});

When you submit, you should be able to access the properties via:
Code:
$unassigned = $this->input->post('unassigned-entries'); // returns array
$low_risk = $this->input->post('lowrisk-entries'); // returns array
//etc...


Messages In This Thread
jquery drag and drop - by El Forum - 10-24-2008, 01:33 PM
jquery drag and drop - by El Forum - 10-24-2008, 04:57 PM
jquery drag and drop - by El Forum - 11-16-2008, 11:35 AM
jquery drag and drop - by El Forum - 11-16-2008, 05:23 PM
jquery drag and drop - by El Forum - 11-21-2008, 09:06 AM
jquery drag and drop - by El Forum - 11-21-2008, 09:12 AM
jquery drag and drop - by El Forum - 11-21-2008, 09:48 AM
jquery drag and drop - by El Forum - 11-21-2008, 09:55 AM
jquery drag and drop - by El Forum - 11-21-2008, 10:16 AM
jquery drag and drop - by El Forum - 07-07-2009, 07:38 AM
jquery drag and drop - by El Forum - 07-09-2009, 01:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB