Solved

drag image properties to textfield

Posted on 2003-11-18
5
248 Views
Last Modified: 2009-12-16

Hello Experts...

Does anyone know how I can (or even if it's possible) click on an image that is display on the page and drop its properties into a textfield.

Wow... that sounds impossible...

Here's what I have.  On my web page I am displaying a number of images.  These image names are all store in an Access database and I just use Javascript to create an array of images and display this array on the page.  Users can scroll up and down this array of images. It's really cool.  I am creating a page where the user can basically type an image name with extension into a textfield on a "user control panel" form. The form will allow users to display images on their personal page. When the user submits the form the textfield value gets assigned to an image <img src="#image#" alt="image variable" /> that will display on the user's screen.  

Rather than have the user type in the actual image name into the textfield I'd like to see if it is possible to highlight and drag an image into the textfield and have the image name appear.  I can do this if I highlight and drag the image name written in text below the image..basically copy and paste.  But I don't don't if there is a way to do this with just an image.  

Maybe it is impossible and perhaps the images need to be displayed on the page a different way...  

Well you all are the experts so I pose this question to you...

Thanks in advance to looking at this....

p.s. Oh I am using cold fusion and javascript on this page.  Don't know if that will have any relevance.
0
Comment
Question by:shogun5
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
D_M_D earned 250 total points
ID: 9779087
You can add a checkbox next to each image and have the user check the image they want and the value of the check box can be the image name (which you have as text now).  Then use Javascript to populate the text field when the user checks a checkbox.

<input type="checkbox" name="img1" value="<script lanugage="JavaScript">document.write(arrayImageName)</script>" Onclick="MoveImageName(img1);">

<script language="JavaScript">
function MoveImageName(imagename){
    // short version
   document.all.textfield.value = document.all.img1.value;
}
</script>


this is just an idea, you will need to name each checkbox in order (ie... img1,img2 etc...)
-------
D_M_D
0
 

Author Comment

by:shogun5
ID: 9783494
D_M_D ,

Thanks dude for your comments...

Yeah, I decided to do the same thing but instead of putting a checkbox next to the image I just click on the image (attach an onClick event to the image) itself and the same of the image gets displayed on the texfield.

I guess the drag and drop idea is a bit overwhelming....

Thanks again....

-mike
0
 
LVL 10

Expert Comment

by:D_M_D
ID: 9787035
That definetly works.  The drag and drop idea probably could work, but would take alot of coding.  good luck.

--------
D_M_D
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11432228
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: D_M_D {http:#9779087}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

pinaldave
EE Cleanup Volunteer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now