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

[eluser]D R Upton[/eluser]
Thanks very much for the very quick reply.
Leaving aside where in my CI files the code is, what is being generated as the HTML page source code is now:
Code:
<head>
<meta name="robots" content="noindex,nofollow">  
<s_cript type='text/javascript' src="http://127.0.0.1/sonof/js/jquery.js"></s_cript>
  <s_cript type='text/javascript' src="http://127.0.0.1/sonof/js/jqcode.js"></s_cript>
  <s_cript type='text/javascript' src="http://127.0.0.1/sonof/js/ui.core.js"></s_cript>
  <s_cript type='text/javascript' src="http://127.0.0.1/sonof/js/ui.draggable.js"></s_cript>
  <s_cript type='text/javascript' src="http://127.0.0.1/sonof/js/ui.droppable.js"></s_cript>
&lt;link rel="stylesheet" type="text/css" href="http://127.0.0.1/sonof//aw2.css"&gt;

<s_cript>
$(document).ready(function(){
$("button.save-risks").click(function() {
    var riskLevels = ['unassigned','lowrisk','medrisk','highrisk'];
    alert{'got here'};
    // dynamically create a new form
    var form = document.createElement('form');
    form.style.display = 'none';
    form.method = 'post';
    form.action = 'http://127.0.0.1/sonof/index.php/start/assess/71/37/4/1.html' // 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.html; //innerText might be a better idea
           var htmlStr = $(this).html();
           alert(htmlStr);

        });        
    }
     form.submit();
});
});
[removed]
&lt;/head&gt;
&lt;body&gt;
//....page stuff and code setting up containers etc....

&lt;INPUT TYPE='button' id='save-risks' class='save-risks' name='save-risks' value='click me3'&gt;
&lt;/body&gt;
&lt;/html&gt;

(NB all those 's_cripts' are like that so the CI forum will show them, in the original it's the s-word without the underscore of course.)

Does this look OK to you?


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