ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-web
perl-win32-web
Re: having a html button/check box call a perl subroutine
by Dhivya Arasappan/O/VCU other posts by this author
Jul 25 2007 8:35AM messages near this date
view in the new Beta List Site
Re: having a html button/check box call a perl subroutine | Re: having a html button/check box call a perl subroutine
<FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size=2> <DIV>Hi,</DIV><DIV
> &nbsp;</DIV><DIV>Thanks for your tips. This is actually similar to what I have right now. T
he problem with calling the same script again, that is, refreshing the entire page when the 
checkbox is clicked is that the checkbox is also refreshed which means it no longer appears 
to be clicked.</DIV> <DIV>&nbsp;</DIV><DIV>I was looking to do something where a person click
s 2 of the 4 checkboxes and only the image/graph changes. Then they unclick say one of the c
heck boxes to see the image/graph change again. So they need to see what boxes are checked a
nd what arent. </DIV> <DIV>&nbsp;</DIV><DIV>Do I think I can still do that somehow when refre
shing the entire script?</DIV> <DIV>&nbsp;</DIV><DIV>thanks</DIV><DIV>dhivya<BR></DIV><FONT c
olor=#990099> -----perl-win32-web-bounces@[...].com wrote: -----<BR><BR></FONT><BLOCKQUOTE st
yle="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid
; MARGIN-RIGHT: 0px"> To: perl-win32-web@[...].com<BR>From: Lachlan &lt;lashley@turing.une.ed
u.au&gt;<BR> Sent by: perl-win32-web-bounces@[...].com<BR>Date: 07/24/2007 10:50PM<BR>Subject
: Re: having a html button/check box call a perl subroutine<BR> <BR><FONT face="Default Monos
pace,Courier New,Courier,monospace" size=2> Firstly, have you looked into combining CSS with 
your javascript?<BR> There are plenty of resources on the web that describe how to use the &n
bsp;<BR> inline parameter to display and hide content.<BR><BR>You won't be able to run a perl
 sub after your page has been rendered &nbsp;<BR> unless you run your script again.<BR>One of
 the most obvious ways is to refresh the page (ie. run the script &nbsp;<BR> again) when the 
checkbox is pressed.<BR> <BR>I haven't done this with a checkbox but I have used a round-abou
t way &nbsp;<BR> of getting a javascript action button to run a Perl sub.<BR>I used a simple 
javascript action button. With the CGI module I used:<BR> <BR>$cgiObject-&gt;button(-name=&gt
;'nameofbutton',-value=&gt;' Label of &nbsp;<BR> Button',-onClick=&gt;"window.open('nameOfScr
ipt? <BR> x=param1&amp;y=param2&amp;z=param3'... )")<BR><BR>A javascript action button is dis
played and when clicked opens a new &nbsp;<BR> window and goes to the address specified using
 the particular params.<BR> One of the params is a flag to indicate a basic function mode for
 the &nbsp;<BR> script; basically which sub should be run (in the example 'x').<BR><BR>Toward
s the start of my script I have something like this ($qaz is the &nbsp;<BR> CGI object):<BR><
BR> if (defined( $qaz-&gt;param('x') )){<BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>if ($qaz-&gt
;param('x') eq 'value1'){<BR> <SPAN>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN>&nbsp;&nbsp;&nbsp;&n
bsp;</SPAN> runSub1();<BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>}<BR><SPAN>&nbsp;&nbsp;&nbsp;&
nbsp;</SPAN> if ($qaz-&gt;param('x') eq 'value2'){<BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><S
PAN> &nbsp;&nbsp;&nbsp;&nbsp;</SPAN>runSub2();<BR><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>}<BR><
SPAN> &nbsp;&nbsp;&nbsp;&nbsp;</SPAN>...<BR>}<BR><BR>You should be able to do something simil
ar with a checkbox using &nbsp;<BR> onClick. Use the window.location.replace(x) function to r
eload the &nbsp;<BR> current page.<BR>Of course, 'x' represents the script name with the para
meter list. If &nbsp;<BR> you use the same sub to set the content and use the param list to a
lter &nbsp;<BR> what is set by that sub then code duplication is minimised - you don't &nbsp;
<BR> need multiple subs to set up different page content if the 'page' &nbsp;is &nbsp;<BR>pra
ctically the same.<BR> <BR><BR>Cheers,<BR>Lachlan.<BR><BR><BR>On 24 Jul 2007, at 7:02, Dhivya
 Arasappan/O/VCU wrote:<BR> <BR>&gt; Hi everyone,<BR>&gt; &nbsp;<BR>&gt; I'm writing a perl p
rogram in which I'm setting up&nbsp;a html checkbox &nbsp;<BR> &gt; such that when it is clic
ked, a perl subroutine is called.<BR> &gt; &nbsp;<BR>&gt; I know that I can call a javascript
 function when&nbsp;a checkbox is &nbsp;<BR> &gt; clicked in the following way:<BR>&gt;<BR>&g
t; print "&lt;input type='checkbox' name='check' value='checkbox' &nbsp;<BR> &gt; onClick='ja
vascriptfn();'&gt;";<BR> &gt;<BR>&gt; But how can I use the same checkbox to call a perl subr
outine?<BR> &gt;<BR>&gt; Any kind of guidance would be really appreciated.<BR>&gt;<BR>&gt; th
anks<BR> &gt;<BR>&gt; dhivya arasappan_______________________________________________<BR>&gt;
 Perl-Win32-Web mailing list<BR> &gt; Perl-Win32-Web@[...].com<BR>&gt; To unsubscribe: <A hre
f="http://listserv.activestate.com/mailman/mysubs" target=blank> http://listserv.ActiveState.
com/mailman/mysubs</A> <BR><BR>_______________________________________________<BR>Perl-Win32-
Web mailing list<BR> Perl-Win32-Web@[...].com<BR>To unsubscribe: <A href="http://listserv.act
ivestate.com/mailman/mysubs" target=blank> http://listserv.ActiveState.com/mailman/mysubs</A>
<BR> </FONT></BLOCKQUOTE><BR></FONT>
Thread:
Dhivya Arasappan/O/VCU
Lachlan
Dhivya Arasappan/O/VCU
Dhivya Arasappan/O/VCU
lashley
Bill Luebkert
Foo JH
Chip Hedler

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved