Hi,
Thanks for helping, but I'm baffled by something right now, maybe you can
shed some more light? See the bottom of this email:
> >Any ideas on how to send the correct hidden values to the right perl
> script?
> >If they're all lumped into one form it won't work. What would you do with
> >the hidden variables in this case? I'd prefer to send them as a
> POST, not a
> >GET, too.
>
>
> First I would add the method="POST" to the form tag, then since the hidden
> values are already known, send them from the post in the javascript as
> below.
>
> 1. add a hidden field to the form
> input type="hidden" name="uid" value="0"
>
> 2. add document.myform.uid.value = num to the script since the
> value passed
> is what is used by your perl scripts. (do it before submission.)
>
> Modified example:
>
> <html>
> <head>
> <title>My Test</title>
> <script language="JavaScript">
> <!--
> function gowhere(num)
> {
> document.myform.uid.value = num
>
> if (num == 1){
> document.myform.submit("a.pl")}
> if (num == 2){
> document.myform.submit("b.pl")}
> if (num == 3){
> document.myform.submit("c.pl")}
> }
> //-->
> </script>
> </head>
>
> <body>
>
> <form method="POST" name="myform">
> <input type="hidden" name="uid" value="0">
> <input src="button.jpg" name="I1" width="77" height="24" border="0"
> type="image" onclick="gowhere(1)"><br>
> <input src="button.jpg" name="I2" width="77" height="24" border="0"
> type="image" onclick="gowhere(2)"><br>
> <input src="button.jpg" name="I3" width="77" height="24" border="0"
> type="image" onclick="gowhere(3)">
> </form>
> </body>
> </html>
>
OK, here's what I tried, but when you click on an image it loads the same
page that it is called from, rather than going to the right perl script:
<script language="JavaScript">
<!--
function gowhere(num){
if (num == 1){
document.myform.source.value="pwapprove";
}
if (num == 2){
document.myform.source.value="disabled";
}
if (num == 3){
document.myform.source.value="new";
}
document.myform.submit("/cgi-bin/clientlist.pl");
}
//-->
</script>
Note that it really just has to call one script, but feed it different
values for the same named variable.
Further down in the html generated by the script that created this page in
the first place:
<form name="myform" method="post">
<input type=hidden name=uid value="$uid">
<input type=hidden name=first_name value="$first_name">
<input type=hidden name=source value="0">
The $uid and $first_name are filled in by the perl script that generated the
page.
and...the image buttons:
<input type="image" name="I1" onclick="gowhere(1)"
src="/test/images/n_s_passwordrequests.gif" width=139 height=22 alt=""
border="0"><br>
<input type="image" name="I2" onclick="gowhere(2)"
src="/test/images/n_s_disabledclients.gif" width=139 height=20 alt=""
border="0"><br>
<input type="image" name="I3" onclick="gowhere(3)"
src="/test/images/n_s_makenewclient.gif" width=139 height=20 alt=""
border="0">
Any ideas why I'm getting a reload of the page, instead of a post to the
proper script?
Thanks, I've gotta dig into this javascript stuff more...
Jack
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------