Is it possible to call a javascript function with an onchange call giving it a perl variable from the calling program
Here is a sample code of what I mean
Perl
my $count = 150;
…
<select name=”social” onchange=”checkLimit (this. $count)”>
javascript
function checkLimit(element,now){
var c = element.value;
alert (“now is ” + now); ###this gives $count is not defined although it is used throughout the perl program with no problem.
var space = 175 – now;
if (c > space) {
alert(“Sorry we have only ” + space + ” spaces left”);
element.selectedIndex = 0;
}
}
We want to limit the total number of folks registered for an event ( 175 – currently registered folks) The current # of registrants is retained in a database value and read at the beginning of the program.
Thanks – hope someone can help this novice javascripter (and relatively novice perl coder.)