Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Checkbox Not Sending Complete Data via Post
Old 06-21-2007, 07:57 PM Checkbox Not Sending Complete Data via Post
Extreme Talker

Posts: 196
Trades: 0
im using the script.aculo.us drag n drop script. i am having an issue getting a checkbox to POST its value if checked, once the row the checkbox is in is moved. I believe that once i change the position of a checkbox, it is no longer considered a child of the parent form. How can i get it back to being part of the original parent form?

Another way of saying is... If i have 10 rows with checkbox's in each row, i check rows 1,2,3,4, then move row 1 to the 3 position (2,3,1,4), then submit, the returning POST array only has 2,3,4. How do i get 1 to be in the array as well?

Interface Script
Code:
<?php /*   needed for IE   */ ?>
<div id="page">
    <div id="sale_row" class="section">
        <div id="item_1" class="lineitem" style="cursor: move;">example 1 <input type="checkbox" name="check_value[]" value="example1"></div>
        <div id="item_2" class="lineitem" style="cursor: move;">example 2 <input type="checkbox" name="check_value[]" value="example2"></div>
    </div>
</div>

<?php /*   set JS outside *page* div   */ ?>
<script type="text/javascript">
    // <![CDATA[
    sections = ['sale_row'];

    <?php /*   this watches for event changes like drag and drop action   */ ?>
    Event.observe(window,'load',init,false);
    function init() {

        <?php /*   add a sortable.create for each group level div   */ ?>
        Sortable.create('sale_row',{tag:'div', dropOnEmpty:true, containment:sections, only:'lineitem', onUpdate:updateData});
    }

    Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
    // ]]>
</script>
*Javasript* that formats and sends url to ajax db update page. When chekbox vars "params" are sent this works perfectly.
Code:
function updateData() {
    var params = '';
    var sections = document.getElementsByClassName('section');
    sections.each(function(section) {
        params = Sortable.serialize(section.id);
        var ajax = new Ajax.Request(page_url,{
            method: 'post',
            parameters: params
        });
    });
}
empiresolutions is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Checkbox Not Sending Complete Data via Post
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15233 seconds with 12 queries