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
> </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> </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> </DIV><DIV>Do I think I can still do that somehow when refre
shing the entire script?</DIV> <DIV> </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 <lashley@turing.une.ed
u.au><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 <BR> unless you run your script again.<BR>One of
the most obvious ways is to refresh the page (ie. run the script <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 <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->button(-name=>
;'nameofbutton',-value=>' Label of <BR> Button',-onClick=>"window.open('nameOfScr
ipt? <BR> x=param1&y=param2&z=param3'... )")<BR><BR>A javascript action button is dis
played and when clicked opens a new <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 <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 <BR> CGI object):<BR><
BR> if (defined( $qaz->param('x') )){<BR><SPAN> </SPAN>if ($qaz->
;param('x') eq 'value1'){<BR> <SPAN> </SPAN><SPAN> &n
bsp;</SPAN> runSub1();<BR><SPAN> </SPAN>}<BR><SPAN> &
nbsp;</SPAN> if ($qaz->param('x') eq 'value2'){<BR><SPAN> </SPAN><S
PAN> </SPAN>runSub2();<BR><SPAN> </SPAN>}<BR><
SPAN> </SPAN>...<BR>}<BR><BR>You should be able to do something simil
ar with a checkbox using <BR> onClick. Use the window.location.replace(x) function to r
eload the <BR> current page.<BR>Of course, 'x' represents the script name with the para
meter list. If <BR> you use the same sub to set the content and use the param list to a
lter <BR> what is set by that sub then code duplication is minimised - you don't
<BR> need multiple subs to set up different page content if the 'page' is <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>> Hi everyone,<BR>> <BR>> I'm writing a perl p
rogram in which I'm setting up a html checkbox <BR> > such that when it is clic
ked, a perl subroutine is called.<BR> > <BR>> I know that I can call a javascript
function when a checkbox is <BR> > clicked in the following way:<BR>><BR>&g
t; print "<input type='checkbox' name='check' value='checkbox' <BR> > onClick='ja
vascriptfn();'>";<BR> ><BR>> But how can I use the same checkbox to call a perl subr
outine?<BR> ><BR>> Any kind of guidance would be really appreciated.<BR>><BR>> th
anks<BR> ><BR>> dhivya arasappan_______________________________________________<BR>>
Perl-Win32-Web mailing list<BR> > Perl-Win32-Web@[...].com<BR>> 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
|