LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-22-2004, 06:38 PM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Rep: Reputation: 48
Perlscript doesn't read selected Pull-down Menu


hi

I have a simple HTML file with javascript:
Code:
<HTML>
<HEAD>
<TITLE>Filterlist Example</TITLE>
</HEAD>
<BODY>

<!-- Load the javascript code -->
<script TYPE="text/javascript" SRC="filterlist.js"></SCRIPT>
<H1></H1>
<FORM NAME="myform" ACTION="">

Filter:
<A HREF="javascript:myfilter.reset()" TITLE="Clear the filter">Clear</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^USA')" TITLE="Show items starting with USA">USA</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^AUS')" TITLE="Show items starting with AUS">AUS</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^CAN')" TITLE="Show items starting with CAN">CAN</A>&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT NAME=regexp onKeyUp="myfilter.set(this.value)">
<INPUT TYPE=button onClick="myfilter.set(this.form.regexp.value)" value="Filter">
<INPUT TYPE=button onClick="myfilter.reset();this.form.regexp.value=''" value="Clear">
<p>

<SELECT NAME="myselect" SIZE=1>
<OPTION></OPTION>
<OPTION>USA NEW YORK
<OPTION>USA LOS ANGELES
<OPTION>AUS SYDNEY
<OPTION>AUS BRISBANE
<OPTION>CAN TORONTO
<OPTION>CAN VANCOUVER

</SELECT>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<script TYPE="text/javascript">

<!--
var myfilter = new filterlist(document.myform.myselect);
//-->

</SCRIPT>
</p>
<P>
</FORM>
            <FORM action="/cgi-bin/show.pl" method="post">
            <input type="Submit" value="send">
</BODY>
</HTML>
I wrote a perl script to read and show on the browser the selected value from Pull-Down Menu,
but it doesn't read the value:
Code:
#!/usr/bin/perl

use CGI;
my $q = CGI->new();

foreach($q->param()){
   $FORM{$_} = $q->param($_);
}

print "content-type:text/html

<HTML>
   <HEAD>
   </HEAD>
   <BODY>
       $FORM{'myselect'};
   </BODY>
</HTML>;
I think the problem is on HTML file.
knows someone what's wrong ?
 
Old 04-23-2004, 01:59 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
You have 2 forms in your html and the submit button is in the second - there should only be one.
 
Old 04-23-2004, 03:26 PM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Original Poster
Rep: Reputation: 48
hi

and how to change the HTML, that JavaScript and Perl script are working independently of each other ?

kind regards
cccc
 
Old 04-23-2004, 03:36 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
Try:
Code:
<HTML>
<HEAD>
<TITLE>Filterlist Example</TITLE>
</HEAD>
<BODY>
<!-- Load the javascript code -->
<script TYPE="text/javascript" SRC="filterlist.js"></SCRIPT>

<FORM action="/cgi-bin/show.pl" method="post">

Filter:
<A HREF="javascript:myfilter.reset()" TITLE="Clear the filter">Clear</A>    
<A HREF="javascript:myfilter.set('^USA')" TITLE="Show items starting with USA">USA</A>    
<A HREF="javascript:myfilter.set('^AUS')" TITLE="Show items starting with AUS">AUS</A>    
<A HREF="javascript:myfilter.set('^CAN')" TITLE="Show items starting with CAN">CAN</A>    
<INPUT NAME=regexp onKeyUp="myfilter.set(this.value)">
<INPUT TYPE=button onClick="myfilter.set(this.form.regexp.value)" value="Filter">
<INPUT TYPE=button onClick="myfilter.reset();this.form.regexp.value=''" value="Clear">

<SELECT NAME="myselect" SIZE=1>
<OPTION></OPTION>
<OPTION>USA NEW YORK</OPTION>
<OPTION>USA LOS ANGELES</OPTION>
<OPTION>AUS SYDNEY</OPTION>
<OPTION>AUS BRISBANE</OPTION>
<OPTION>CAN TORONTO</OPTION>
<OPTION>CAN VANCOUVER</OPTION>
</SELECT>
<input type="Submit" value="send">                
<script TYPE="text/javascript">
<!--
var myfilter = new filterlist(document.myform.myselect);
//-->
</SCRIPT>
</FORM>
</BODY>
</HTML>
 
Old 04-23-2004, 04:51 PM   #5
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Original Poster
Rep: Reputation: 48
hi

Thanks, but If I try this HTML, then the JavaScript doesn't work anymore.

greetings
cccc
 
Old 04-23-2004, 04:52 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
The forum automatically changes "javascript" to "java script" - just remove the space.
 
Old 04-23-2004, 05:18 PM   #7
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Original Poster
Rep: Reputation: 48
perl works correctly now, but java script doesn't work

where exactly, should I remove the space ?

Last edited by cccc; 04-23-2004 at 05:21 PM.
 
Old 04-23-2004, 08:52 PM   #8
gizmo_thunder
Member
 
Registered: Apr 2004
Posts: 101

Rep: Reputation: 15
<script TYPE="text/javascript" SRC="filterlist.js"></SCRIPT>
put that line in the head tag..!!
i mean in between <head> and </head> hope this helps
 
Old 04-24-2004, 03:38 PM   #9
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Original Poster
Rep: Reputation: 48
hi

I have tried, but still doesn't work.

my HTML:
Code:
<HTML>
<HEAD>
<TITLE>Filterlist Example</TITLE>
<SCRIPT TYPE="text/javascript" SRC="filterlist.js"></SCRIPT>
</HEAD>
<BODY>
<!-- Load the javascript code -->
<FORM NAME="myform" ACTION="">
Filter:
<A HREF="javascript:myfilter.reset()" TITLE="Clear the filter">Clear</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^USA')" TITLE="Show items starting with USA">USA</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^AUS')" TITLE="Show items starting with AUS">AUS</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^CAN')" TITLE="Show items starting with CAN">CAN</A>&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT NAME=regexp onKeyUp="myfilter.set(this.value)">
<INPUT TYPE=button onClick="myfilter.set(this.form.regexp.value)" value="Filter">
<INPUT TYPE=button onClick="myfilter.reset();this.form.regexp.value=''" value="Clear"><p>

<SELECT NAME="myselect" SIZE=1>
<OPTION>
<OPTION>AUS SYDNEY
<OPTION>AUS BRISBANE
<OPTION>CAN TORONTO
<OPTION>CAN VANCOUVER
<OPTION>USA NEW YORK
<OPTION>USA LOS ANGELES

</SELECT>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<SCRIPT TYPE="text/javascript">

<!--
var myfilter = new filterlist(document.myform.myselect);
//-->

</SCRIPT>
</p>
<P>
</FORM>
             <FORM action="/cgi-bin/show.pl" method="post">
             <input type="Submit" value="send">
</BODY>
</HTML>
 
Old 04-25-2004, 01:37 AM   #10
gizmo_thunder
Member
 
Registered: Apr 2004
Posts: 101

Rep: Reputation: 15
sorry dude but i really could not figure out the problem..
may be if you gime the code of the filter.js ill' try to debug and
try it myself and tell you.
 
Old 04-25-2004, 08:05 AM   #11
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
What output do you get from the perl script? Is it just a blank page?
 
Old 04-25-2004, 10:22 AM   #12
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Original Poster
Rep: Reputation: 48
YES, it is...
 
Old 05-27-2004, 10:30 AM   #13
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Original Poster
Rep: Reputation: 48
hi

this one works well:
Code:
<HTML>
<HEAD>
<TITLE>Filterlist Example</TITLE>
<SCRIPT TYPE="text/javascript" SRC="filterlist.js"></SCRIPT>
</HEAD>
<BODY>
<!-- Load the javascript code -->

<FORM NAME="myform" action="/cgi-bin/show.pl" method="post">

Filter:
<A HREF="javascript:myfilter.reset()" TITLE="Clear the filter">Clear</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^USA')" TITLE="Show items starting with USA">USA</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^AUS')" TITLE="Show items starting with AUS">AUS</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="javascript:myfilter.set('^CAN')" TITLE="Show items starting with CAN">CAN</A>&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT NAME=regexp onKeyUp="myfilter.set(this.value)" size="20">
<INPUT TYPE=button onClick="myfilter.set(this.form.regexp.value)" value="Filter">
<INPUT TYPE=button onClick="myfilter.reset();this.form.regexp.value=''" value="Clear"><BR><BR>

<SELECT NAME="myselect" SIZE=1>
<OPTION>
<OPTION>AUS SYDNEY
<OPTION>AUS BRISBANE
<OPTION>CAN TORONTO
<OPTION>CAN VANCOUVER
<OPTION>USA NEW YORK
<OPTION>USA LOS ANGELES
</SELECT><BR><BR>

<input type="Submit" value="send">

<SCRIPT TYPE="text/javascript">
<!--
var myfilter = new filterlist(document.myform.myselect);
//-->
</SCRIPT>
</BODY>
</HTML>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pull-down menu items blank in java app mfeat Linux - Software 2 02-06-2005 12:48 PM
I'm looking for perlscript to delete some files via ftp cccc Programming 1 02-24-2004 02:56 AM
need a perlscript to read from a text file and transfer files via ftp cccc Linux - Networking 2 02-21-2004 07:18 PM
Why cannot i boot win98 with it selected in lilo menu whepin Linux - Newbie 9 12-20-2001 11:01 PM
How to run a perlscript during boot up Notfromkansas Linux - General 7 11-10-2001 10:40 AM


All times are GMT -5. The time now is 01:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration