i'm willing to pay for help and if you want to call me, I'll pay for the call... I SWEAR... (not a lot, but i will pay )
**************************************************
514-521-1515 (don't worry if they anwser in french... just ask for Mr. Jean-Philippe Bertrand
*************************************************
I'm trying to mix perl et javascript.
I've modified a tree menu script and the tree appears and works fine. Within that tree, I have several checkbox and in their own "div" which I want to collect and send to a hidden form further down the code.
Here is the problem. I keep getting a "missing ; before statement" error. I've look and look and look but I can't find the bugger.
it happends when I check the checkbox...
can you help, here is my code for the tree and right after is the perl code with JS inside...
here is the url:
JS CODE: see attachment
# JS CODE WITHIN PERL #
$menu .= "<script language=\"javascript\">\n";
$menu .= "var TREE_ITEMS = [\n";
$old1 = -1;
$fm_cpt = 0;
while ( ( $gr_id, $BDniv1,$BDniv2,$BDniv3,$BDref,$BDstatus ) = $result->fetchrow )
{
$fm_cpt++;
$new1 = $BDniv1;
$new2 = $BDniv2;
$new3 = $BDniv3;
if ( $BDniv1 < 10 )
{
$BDniv1 = "0".$BDniv1;
}
if ( $BDniv3 =~ /C/ || $BDniv3 =~ /c/ )
{
$BDlien = "../mp_cadre.htm";
$BDtarget = "cadre";
}
elsif ( $BDniv3 =~ /P/ || $BDniv3 =~ /p/ )
{
$BDlien = "../mp_porte.htm";
$BDtarget = "cadre";
}
#elsif ( $BDniv2 =~ /X/ )
#{
# $BDlien = "mp_groupes.pl?no_dossier=${no_dossier}&groupe=${BDniv1}&modNewItem=1";
# $BDtarget = "_self";
#}
else
{
$BDlien = "null";
$BDtarget = "";
}
if ( $BDstatus == 3 )
{
$fc = "#009900";
}
elsif ( $BDstatus == 2 )
{
$fc = "#FF6600";
}
else
{
$fc = "#000000";
}
if ( $new1 ne $old1 ) # si new1 est différent de old1
{
if ( $BDniv3 ne "") # si niveau 3 n'est pas vide
{
if ( $old3 ne "" ) # si old3 est vide
{
$menu .= "],\n";
$menu .= "],\n";
}
elsif ( $old2 ne "" ) # si old2 est vide
{
$menu .= "],\n";
}
$menu .= "['GR${BDniv1}</td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=1_${gr_id} name=chkniv1${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=${BDlien} target=${BDtarget}><font color=$fc><b>$BDniv3</b></font></a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=3_${gr_id} name=chkniv3${gr_id} type=checkbox value=1></form>',null],\n";
}
elsif( $BDniv2 ne "") # si niveau 2 n'est pas vide
{
if ( $old3 ne "" ) # si old3 est vide
{
$menu .= " ],\n";
$menu .= "],\n";
}
elsif ( $old2 ne "" ) # si old2 est vide
{
$menu .= "],\n";
}
$menu .= "['GR${BDniv1}</td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=1_${gr_id} name=chkniv1${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null],\n";
}
else # si niveau 2-3 sont vides
{
if ( $old3 ne "" ) # si old3 n'est pas vide
{
$menu .= "],\n";
$menu .= "],\n";
}
elsif ( $old2 ne "" ) # si old2 n'est pas vide
{
$menu .= "],\n";
}
#$menu .= "['GR${BDniv1}','$BDlien'],\n";
$menu .= "['GR${BDniv1}</td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=1_${gr_id} name=chkniv1${gr_id} type=checkbox value=1></form>',null],\n";
}
}
else # si new1 est égale à old1
{
if ($new2 eq $old2) # si new2 est égale à old2
{
if ($new3 ne "")
{
$menu .= " ['<a href=${BDlien} target=${BDtarget}><font color=$fc><b>$BDniv3</b></font></a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=3_${gr_id} name=chkniv3${gr_id} type=checkbox value=1></form>',null],\n";
}
else
{
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null],\n";
}
}
else # si new2 n'est pas égale à old2
{
if ( $new3 ne "" )
{
if ( $old3 ne "" )
{
$menu .= " ],\n";
}
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=${BDlien} target=${BDtarget}><font color=$fc><b>$BDniv3</b></font></a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=3_${gr_id} name=chkniv3${gr_id} type=checkbox value=1></form>',null],\n";
}
else
{
if ( $old3 ne "" )
{
$menu .= " ],\n";
}
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>','$BDlien'],\n";
}
}
}
$old1 = $new1;
$old2 = $new2;
$old3 = $new3;
}# END OF WHILE
END OF PERL CODE ########################
Please help me... JP, a friendly programmer... -
**************************************************
514-521-1515 (don't worry if they anwser in french... just ask for Mr. Jean-Philippe Bertrand
*************************************************
I'm trying to mix perl et javascript.
I've modified a tree menu script and the tree appears and works fine. Within that tree, I have several checkbox and in their own "div" which I want to collect and send to a hidden form further down the code.
Here is the problem. I keep getting a "missing ; before statement" error. I've look and look and look but I can't find the bugger.
it happends when I check the checkbox...
can you help, here is my code for the tree and right after is the perl code with JS inside...
here is the url:
JS CODE: see attachment
# JS CODE WITHIN PERL #
$menu .= "<script language=\"javascript\">\n";
$menu .= "var TREE_ITEMS = [\n";
$old1 = -1;
$fm_cpt = 0;
while ( ( $gr_id, $BDniv1,$BDniv2,$BDniv3,$BDref,$BDstatus ) = $result->fetchrow )
{
$fm_cpt++;
$new1 = $BDniv1;
$new2 = $BDniv2;
$new3 = $BDniv3;
if ( $BDniv1 < 10 )
{
$BDniv1 = "0".$BDniv1;
}
if ( $BDniv3 =~ /C/ || $BDniv3 =~ /c/ )
{
$BDlien = "../mp_cadre.htm";
$BDtarget = "cadre";
}
elsif ( $BDniv3 =~ /P/ || $BDniv3 =~ /p/ )
{
$BDlien = "../mp_porte.htm";
$BDtarget = "cadre";
}
#elsif ( $BDniv2 =~ /X/ )
#{
# $BDlien = "mp_groupes.pl?no_dossier=${no_dossier}&groupe=${BDniv1}&modNewItem=1";
# $BDtarget = "_self";
#}
else
{
$BDlien = "null";
$BDtarget = "";
}
if ( $BDstatus == 3 )
{
$fc = "#009900";
}
elsif ( $BDstatus == 2 )
{
$fc = "#FF6600";
}
else
{
$fc = "#000000";
}
if ( $new1 ne $old1 ) # si new1 est différent de old1
{
if ( $BDniv3 ne "") # si niveau 3 n'est pas vide
{
if ( $old3 ne "" ) # si old3 est vide
{
$menu .= "],\n";
$menu .= "],\n";
}
elsif ( $old2 ne "" ) # si old2 est vide
{
$menu .= "],\n";
}
$menu .= "['GR${BDniv1}</td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=1_${gr_id} name=chkniv1${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=${BDlien} target=${BDtarget}><font color=$fc><b>$BDniv3</b></font></a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=3_${gr_id} name=chkniv3${gr_id} type=checkbox value=1></form>',null],\n";
}
elsif( $BDniv2 ne "") # si niveau 2 n'est pas vide
{
if ( $old3 ne "" ) # si old3 est vide
{
$menu .= " ],\n";
$menu .= "],\n";
}
elsif ( $old2 ne "" ) # si old2 est vide
{
$menu .= "],\n";
}
$menu .= "['GR${BDniv1}</td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=1_${gr_id} name=chkniv1${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null],\n";
}
else # si niveau 2-3 sont vides
{
if ( $old3 ne "" ) # si old3 n'est pas vide
{
$menu .= "],\n";
$menu .= "],\n";
}
elsif ( $old2 ne "" ) # si old2 n'est pas vide
{
$menu .= "],\n";
}
#$menu .= "['GR${BDniv1}','$BDlien'],\n";
$menu .= "['GR${BDniv1}</td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=1_${gr_id} name=chkniv1${gr_id} type=checkbox value=1></form>',null],\n";
}
}
else # si new1 est égale à old1
{
if ($new2 eq $old2) # si new2 est égale à old2
{
if ($new3 ne "")
{
$menu .= " ['<a href=${BDlien} target=${BDtarget}><font color=$fc><b>$BDniv3</b></font></a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=3_${gr_id} name=chkniv3${gr_id} type=checkbox value=1></form>',null],\n";
}
else
{
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null],\n";
}
}
else # si new2 n'est pas égale à old2
{
if ( $new3 ne "" )
{
if ( $old3 ne "" )
{
$menu .= " ],\n";
}
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>',null,\n";
${fm_cpt}++;
$menu .= " ['<a href=${BDlien} target=${BDtarget}><font color=$fc><b>$BDniv3</b></font></a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=3_${gr_id} name=chkniv3${gr_id} type=checkbox value=1></form>',null],\n";
}
else
{
if ( $old3 ne "" )
{
$menu .= " ],\n";
}
$menu .= " ['<a href=mp_groupes.pl?gr_id=${gr_id}&no_dossier=${no_dossier}&mod_item=1 target=_self>${BDniv2}</a></td><td><form name=lay_form${fm_cpt}><input onChange=document.hid_form.chk${fm_cpt}.value=2_${gr_id} name=chkniv2${gr_id} type=checkbox value=1></form>','$BDlien'],\n";
}
}
}
$old1 = $new1;
$old2 = $new2;
$old3 = $new3;
}# END OF WHILE
END OF PERL CODE ########################
Please help me... JP, a friendly programmer... -
Comment