Page 1 of 1

Moving images help!!!

Posted: Sat Jan 03, 2004 2:05 am
by ashwin
Hi,
I need help in pertinent to a "Survey form" and I would be very very grateful if anyone could help me out.

I have created a page which has objects (basically a gif file(s) ) of size Width=100 and Height=40 (along with a few questionnaires). The user can drag this image by clicking on it and also he can rotate it (This is done using HTML and JavaScript). Below these objects I have placed a browser (IE) image file (again a gif file) so that the user can move these objects and place it anywhere on the browser.gif. Also, there will be a Submit button down the page and when the user clicks on the Submit button the user will be taken to a PHP page which indicates "Thank you for your time" and data will be stored in a MySql database file.

Now, coming to the query. When the user drags the object(s) to anywhere in the browser.gif file I need to know the position as to where the user placed the objects and when the user hits the Submit button these position(s) need to be sent to the script and then in turn to the database file. I need to know as to how I can go about in doing this. I hope I was clear with my query and if you are not clear do write back.
Thank you

Posted: Sat Jan 03, 2004 11:54 am
by aquila125
make a form with some hidden fields.. and let javascript change the values of these fields.. when the users hits the submit button, you can grab the variables from POST or GET..

Posted: Sat Jan 03, 2004 1:13 pm
by ashwin
This is the topic I was talking about..here is the link

http://www21.brinkster.com/sashwin/survey/moving.html

do you think finding out the co-ordinates and printing it is the best way???

Posted: Sat Jan 03, 2004 1:50 pm
by Gen-ik
aquila125 has just given you the best way of doing this. As he said, every time an image is moved you need to update a hidden <input> value in a <form> and when the submit button is pressed these values are then sent to your PHP so you can store them.

Posted: Sat Jan 03, 2004 3:33 pm
by DuFF
Just to let you know, the dragging images don't work in Mozilla Firebird :?

Posted: Sat Jan 03, 2004 4:17 pm
by Gen-ik
Hmmm, I would also be surprised if it works in Netscape considering that event.srcElement is being used.

I have got a little JS script that deals with document objects/events and is pretty browser friendly... I will try and dig it out for shortly.

Please Help me!!

Posted: Sat Jan 03, 2004 10:08 pm
by ashwin
Hi,
I have been trying this stuff for the last few hours and I am not able to find the solution. Please do help me out.

I have created a image as seen in this page http://www21.brinkster.com/sashwin/survey/test.html The image can be moved by dragging on it. When you click on the image I get he X and Y co-ordinates but its wrong. Now, the user will move the image wherever he/she wants it to be placed in the browser window. I need to know the co-ordinates of the image as and when the image is dragged and dropped. Can anyone tell me as to how can I do this stuff.

Thnak you

Posted: Sun Jan 04, 2004 10:35 am
by Derfel Cadarn
DuFF wrote:Just to let you know, the dragging images don't work in Mozilla Firebird :?
The same goes for Konqueror...