LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 05:38 PM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 51
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, 12:59 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

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

Original Poster
Rep: Reputation: 51
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, 02:36 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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, 03:51 PM   #5
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
hi

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

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

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

Original Poster
Rep: Reputation: 51
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 04:21 PM.
 
Old 04-23-2004, 07: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, 02:38 PM   #9
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
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, 12: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, 07:05 AM   #11
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

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

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

Original Poster
Rep: Reputation: 51
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 11:48 AM
I'm looking for perlscript to delete some files via ftp cccc Programming 1 02-24-2004 01:56 AM
need a perlscript to read from a text file and transfer files via ftp cccc Linux - Networking 2 02-21-2004 06:18 PM
Why cannot i boot win98 with it selected in lilo menu whepin Linux - Newbie 9 12-20-2001 10:01 PM
How to run a perlscript during boot up Notfromkansas Linux - General 7 11-10-2001 09:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:25 PM.

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
Open Source Consulting | Domain Registration