Perhaps you could do something like the following. You would have a generic form that can be submitted with a dynamic value based on what image is clicked. This is one possible solution.

<script type="text/javascript">
function submitform(imageNum) {
 var f = document.form_image;
 f.imageNumber.value = imageName;
 f.submit();
}
</script>

<form name="form_image" method="post" action="$jslink.setAction("portlets.ActiveRegionMonitor")">

<input type="hidden" name="imageNumber" value=""/>
<input type="hidden" name="eventSubmit_doImage" value="1"/>
</form>


#foreach($image in $imageList) #set($imageNum = $velocityCount) <img src="$image" onClick="submitForm($imageNum)"/> #end

Jeremy Ford
[EMAIL PROTECTED]


From: "Remo Waller" <[EMAIL PROTECTED]>
Reply-To: <[EMAIL PROTECTED]>
To: "'Jetspeed Users List'" <[EMAIL PROTECTED]>
Subject: How to get additional mehtod parameters in a form-url, but not with hidden fields
Date: Tue, 8 Jun 2004 13:24:27 +0200


Hy,

I've written a portlet, which shows several images. By clicking on a such
image, i should be loaded in the portlet in a larger size. Therefor I'm
using a Velocityportlet. It looks as following:

<form name="form_image" method="post"
action="$jslink.setAction("portlets.ActiveRegionMonitor")">
#set($tmp = 1)
        #foreach($image in $imageList)
                <input type="image" src="$image" width=100
name="eventSubmit_doImage$tmp" value="show events">
        #end
#set($tmp=${tmp}+1)
</form>

All images (or the source of this image -> http://xxx/image.jpg) are in the
$imageList. I defined 1 form, which will be called, when the users will
click on a image. There are max. 5 small images. That i can determine, which
image was clicked I implemented in the Portlet
(portlets.ActiveRegionMonitor) 5 methods doImage$tmp (doImage1 - doImage5).
The reason is, that i know the sourceaddress of the image:


        public void doImage2(RunData rundata, Context context) {
                String tmp = ((String[])
rundata.getUser().getTemp(Constants.IMAGE_LIST))[1];
                tmp = tmp.replaceAll("thumb", "fd");
                rundata.getUser().setTemp(Constants.IMAGE2, tmp);
        }


But this is not a quite nice solution. Is there a way to give additional parameters to a method, invoked by this form like:

<input type="image" src="$image" width=100
name="eventSubmit_doImage$tmp?name=value" value="show events">

^^^^^^^^^^^^^^

?

Best regards and thanks for answers.

Remo


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________ Check out the coupons and bargains on MSN Offers! http://youroffers.msn.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to