Gossamer Forum
Home : Products : DBMan : Installation :

Perl / Javascript confict

Quote Reply
Perl / Javascript confict
I will post some code, that works fine for me, only when I define the perl work in the Javascript myself. The problem is, that a list is defined, depended on some fields in my DB. This is the code, that must be modified:
Code:
$Merk_number = 2; # field number of the Make field
$Type_number = 4; # field number of the Type field

open (DB, "<$db_file_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
next if /^#/;
next if /^\s*$/;
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
if (!(grep $_ eq $fields[$Type_number], @{$Types{$fields[$Merk_number]}})) {
push (@{$Types{$fields[$Merk_number]}}, $fields[$Type_number]);
}
if (!(grep $_ eq $fields[$Merk_number], @Merks)) {
push (@Merks, $fields[$Merk_number]);
}
}
close DB;

#=====================================================================#
#==# IN THIS PART THE PERL MUST DO HIS WORK #==#
#==# ONLY I DO NOT KNOW HOW... #==#
#=====================================================================#

<Script Language="Javascript"> # MUST BE HERE!!

foreach $Merk (sort @Merks) {
$Array = "Array";
$Mark = "$Merk$Array";
print qq~


var $Mark = new Array("('Select Type','',true,true)",<br>~;
foreach $type (sort @{$Types{$Merk}}) {
print qq~"('$type')",~;
}
print qq~"('Alle modellen')");<br>~;
});
==================
I clean this up a bit, because I solve this with an extern '.js' file, see the code in my reply below.

[This message has been edited by mart (edited September 14, 1999).]
Subject Author Views Date
Thread Perl / Javascript confict mart 1674 Sep 14, 1999, 4:57 AM
Post Re: Perl / Javascript confict
Eliot 1621 Sep 14, 1999, 6:34 PM
Post Re: Perl / Javascript confict
mart 1613 Sep 14, 1999, 7:08 PM
Post Re: Perl / Javascript confict
Eliot 1619 Sep 14, 1999, 9:15 PM
Post Re: Perl / Javascript confict
Eliot 1598 Sep 15, 1999, 4:35 AM
Post Re: Perl / Javascript confict
mart 1610 Sep 15, 1999, 4:46 AM
Post Re: Perl / Javascript confict
Eliot 1606 Sep 15, 1999, 5:25 AM
Post Re: Perl / Javascript confict
mart 1599 Sep 15, 1999, 6:54 AM
Post Re: Perl / Javascript confict
mart 1601 Sep 15, 1999, 10:37 AM