Thanks Nino,
The model is just a quick hack to show where the imageresource is coming
from, i.e. it's dynamic.
The ClientSideImageMap and the older ImageMap don't give an x and y of
the click and I don't fancy creating a <map/> for every pixel in the image.
The ImageButton does return where the user clicked on the image as part
of the form submit. I was hoping that the x and y could be mapped to a
model somehow.
How I managed to get the coords is like this
Form<Object> form = new Form<Object>("form") {
@Override
protected void onSubmit() {
info("x = " + getRequest().getParameter("picture.x"));
info("y = " + getRequest().getParameter("picture.y"));
}
};
It would be nice to attach these values to a property, can you see a way
of doing that?
Tim
Nino Saturnino Martinez Vazquez Wael wrote:
maybe james patch can help you :
http://www.nabble.com/Client-Side-Image-Map...-td20516107.html#a20516107
?
Otherwise it should be ImageMap already there..
Nino Saturnino Martinez Vazquez Wael wrote:
Hi Tim
You should get a grasp on models. But isnt it an imagearea (cant
remember the exact name) or something you want? Image button is just
a button which has a image...
Tim Squires wrote:
Hi,
I'm trying to retrieve the x and y coords from a user click on an
ImageButton. Can anyone tell me how to get these parameters in an
onSubmit method?
Currently I'm doing
final IModel<Picture> picture = new
AbstractReadOnlyModel<Picture>() {
@Override
public Picture getObject() {
return pictureService.findRandom();
}
};
Form<Object> form = new Form<Object>("form") {
@Override
protected void onSubmit() {
// picture.x and picture.y
parameters, where are they?
}
};
form.add(new ImageButton("picture", new
ImageResource(defaults
.getPicturesLocation(), picture)));
add(form);
but cannot find any way of retrieving the page parameters in the
onSubmit() - getPageParameters() returns null.
I'm using 1.4-rc1.
Thanks for any help,
Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]