Gossamer Forum
Home : Products : DBMan : Installation :

Check all / uncheck all in the delete from

Quote Reply
Check all / uncheck all in the delete from
Hi,
I've mentionned before that I'm doing a little system which employes will use to keep a log of their hours and activities.

This information is then used for 2 things. preparing the pays and billing the clients. This information is not ongoing, at least not online. Once the employes are payed and they're trough with a client. The information in the online system can be discarded. The system will probably never have to hold much more than 150 records at the same time.

That's why I would like to add 2 little buttons in the delete form. One that would check all the records and one that would uncheck all of them.
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
I think that would require something like Java to do. I know how to set it up so that all of the records are automatically checked when you go to the delete form. And I know how to make records automatically delete when you click a link, based on a comparison between the date in a field and the current date. But not to change the status of a form that's currently on the browser.


------------------
JPD





Quote Reply
Re: Check all / uncheck all in the delete from In reply to
Carol,

It's JavaScript, not Java. Some Javascript/Java programmers would have your guts for garters for that! Smile

luc_a,

You're looking for the subroutine html_delete_form in html.pl. In the HEAD of the document add the JavaScript:

(This code has been edited since my original posting!!!)

<script language="JavaScript">
<!--
function CheckAll() {
for (var i=0;i<document.forms[0].elements.length;i++) {
var e = document.forms[0].elements;
if (e.name != 'allbox')
e.checked = document.forms[0].allbox.checked;
}
}
// -->
</script>

I don't think that Perl will interfere with any of that when it delivers it, but if it does, post here again and I'll try and sort it out. Now, add the checkbox that will check/uncheck all items. I would advise putting it at the bottom of the page, under all the other checkboxes, otherwise the page mightn't be fully loaded and it won't work.

<input name="allbox" type="checkbox" value="Check All" onClick="CheckAll();">(Un)Check All

That should do it. If it looks familiar, login to Hotmail and you'll see why! Smile

Cheers,
adam

[This message has been edited by dahamsta (edited April 30, 1999).]
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
Hi again,
it dosn't work. I can't run the program at all. The message says there's error loading librairies in html.pl ?
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
please don't try accesing the data or that directory.
thanks
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
luc_a,

Hi again. Well, I just added it to my local install of dbMan and it works ok. Could you copy your html.pl over to a .txt file in a web accessible directory (somewhere I can look at it via the internet) for me so I can have a look at it? Just post a link to it here.

adam
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./html.pl line 35, near "for "
Can't use subscript on constant item at ./html.pl line 35, near "0]"
syntax error at ./html.pl line 35, near "++) "
syntax error at ./html.pl line 38, near ")
e"


I put the script just before the globals section. so line 35 would be:
for (var i=0;i<document.forms[0].elements.length;i++) {
and 38:
e.checked = document.forms[0].allbox.checked;



[This message has been edited by luc_a (edited May 01, 1999).]
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
Sorry Adam. Smile I did look around after I posted that and found that Javascript would be the thing to use. I'm learning! Smile

luc, be sure to put the Javascript code within a print qq| statement. This is something that's going to go on the web page, and not part of the Perl script.


------------------
JPD





Quote Reply
Re: Check all / uncheck all in the delete from In reply to
 
Huh?

What data? What directory?
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
Hi,
I had put a link to a text version of my html. It contained the URL to the server I'm woring on. I edited my post because about an hour after that something happened: I coulddn't acces the data anymore (it's a long funny story).

Anyway, here's a link to my html.txt. I tryed adding the print qq, didn't work.

http://bennyhills.fortunecity.com/mortimer/447/netnovelties/html.txt
Quote Reply
Re: Check all / uncheck all in the delete from In reply to
Move the entire code:

Code:
<script language="JavaScript">
<!--
function CheckAll() {
for (var i=0;i<document.forms[0].elements.length;i++) {
var e = document.forms[0].elements;
if (e.name != 'allbox')
e.checked = document.forms[0].allbox.checked;
}
}
// -->
</script>

to html_delete_form, just after

<title>$html_title: Supprimez un(des) enregistrements(s)</title>

(I'm pretty sure that's where it goes. Pages with Javascript have had the code before the </head> tag.)

I don't know that this will make the Javascript work, but I do know that it will make it so your script won't crash.


------------------
JPD





Quote Reply
Re: Check all / uncheck all in the delete from In reply to
It works great! Thanks again.

That's a very usefull little feature that can be used in many occcasions.