Topic: How Check all checkbox In PM Mod ?

Hello

Is it possible to Select to unselect  checkbox in Mulptiple delete Message ??

Exemple :

http://img246.imageshack.us/img246/518/a9uh.jpg


i find this script .

<SCRIPT LANGUAGE="javascript">
function checkAll() {
    var i=0;

    while (document.folder_list.elements[i]) {
        if (document.folder_list.elements[i].name=='delete_messages[]') {
            document.folder_list.elements[i].checked=!document.folder_list.elements[i].checked;
        }

        i++;
    }
}
</SCRIPT>


<p><a HREF="javascript:checkAll();">Selectionner/Inv</a></p>

<form  name="folder_list" method="POST" >

    <p><input type="checkbox" name="delete_messages[]" value="ON"></p>
    <p><input type="checkbox" name="delete_messages[]" value="ON"></p>
    <p><input type="checkbox" name="delete_messages[]" value="ON"></p>
    <p><input type="checkbox" name="delete_messages[]" value="ON"></p>
</form>

Is it adaptable for punBB for integratd in message_list.php ??

Thx

Re: How Check all checkbox In PM Mod ?

A javascript would do the trick, yes. But that script you just qouted is not going to do it. What that one does is that it inverts all checkboxes named like the ones in the form. And I'm not sure whether the while loop can be used like that.

Aftonbörsens skapare. Var med och starta något roligt och stort du med!

3 (edited by nico_somb 2006-06-01 08:34)

Re: How Check all checkbox In PM Mod ?

I did it wink


Open message_list.php :

Find : (the second one)

<form method="post" action="message_list.php">

Replace by :

<form method="post" name="folder_list" action="message_list.php">

Find :

<?php

// Fetch messages
$result = $db->query('SELECT * FROM '.$db->prefix.'messages WHERE owner='.$pun_user['id'].' AND status='.$box.' ORDER BY posted DESC LIMIT '.$limit) or error('Unable to fetch messages list for forum', __FILE__, __LINE__, $db->error());
$new_messages = false;
$messages_exist = false;

Before, add :

<SCRIPT LANGUAGE="javascript">
function checkAll() {
    var i=0;

    while (document.folder_list.elements[i]) {
        if (document.folder_list.elements[i].name=='delete_messages[]') {
            document.folder_list.elements[i].checked=!document.folder_list.elements[i].checked;
        }

        i++;
    }
}
</SCRIPT>

Find :

}
else
{
    $cols = isset($_GET['action']) ? '4' : '3';
    echo "\t".'<tr><td class="puncon1" colspan="'.$cols.'">'.$lang_pms['No messages'].'</td></tr>'."\n";
}
?>
            </tbody>
            </table>
        </div>
    </div>
</div>

After, add :

<p><a HREF="javascript:checkAll();">Select all</a></p>

Save/Upload


Enjoy smile !

Re: How Check all checkbox In PM Mod ?

Thx smile
Merci smile