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 lashley other posts by this author
Jul 25 2007 9:06PM 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
I don't think it is possible to just run something in the script without
refreshing the page (reloading the script), however knowing the ingenuity
of full-time Perl hackers I would not be surprised if someone has figured
out how to do something similar.

The controls from the CGI module uses what can be thought of as sticky
values. The params from a form can be transferred to the next form and be
set as values for the fields in a new page. For example; you have a page
of checkboxes and a submit button. When a person clicks 'submit', the
values of the checkboxes are loaded into the param list and is accessible
via $object-> pram('name'). These values are not cleared and CGI will
automagically set the values of checkboxes on the new page with values in
the param list if they have the same name as the checkboxes used in the
previous page.
This can be overridden by using $object-> delete_all()(clears the param
list) or setting the optional -override parameter in the particular form
control to 1.

You could try out that method or you can sort of emulate it with GET.
Emulating this action will depend on how many controls you want to set
after reload. With this method you could add the required values to keep
to the param list (with the URL that reloads the page). If you have heaps
of values the param list at the end of the URL may become unmanageable.

Therefore, the other way is to simulate a submit form action so the CGI
module will do everything using POST instead of the previous method that
uses GET to set param values.
For specific data values that are not actually controls, for example the
function flag mentioned in my previous post, use a hidden control and set
-value to the value you want.

This method is much simpler as the param values will be virtually hidden,
unlike the previous method that requires the values to be placed in the
param section of the URL.

Lachlan.


>  Hi, Thanks for your tips. This is actually similar to what I have right
>  now. The 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. I was looking to
>  do something where a person clicks 2 of the 4 checkboxes and only the
>  image/graph changes. Then they unclick say one of the check boxes to see
>  the image/graph change again. So they need to see what boxes are checked
>  and what arent.  Do I think I can still do that somehow when refreshing
>  the entire script? thanksdhivya

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
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