PDA

View Full Version : Help with form problem



delvin
07-16-2005, 10:56 AM
Hi there
Can i just start by saying that as a noob I dont know if this is the right place to post this question so please feel free to move this post to the right place if necessary :o

I am creating a form to collect information for my mums website. One of the select options requires them to choose from a range of images that are set up on another page of the site (there are to many of them to have the images on the same page as the form). I have assigned all the images a code lettering eg GSA01 etc. So thats basically make a selection choice on page x and post the information in the form selection box on page y

Is there a way that I can either make the images clickable so that the image code will then appear in the selection box or maybe use a click box and select button to do the same so they can only assign one code to the selection - this is important.

i have looked thru the forms scripts on the site and also had a browse thru the forum and cant find anything that seems to fit the bill and am at my wits end, pulling what little hair I have out of my head.

I am new to Java and website building so any help or advice you can give would be very gratefully recieved

Twey
07-16-2005, 11:40 AM
Right.
1) Yes this is in the wrong place, it should be in the JavaScript forum.
2) Java and JavaScript are two very different languages. Don't confuse them.
3) The code you want is:

<img src="image1.jpg" onclick="document.getElementById('imgcode').value='GSA01';"/>
<img src="image2.jpg" onclick="document.getElementById('imgcode').value='GSA02';"/>
<!-- ... more images ... -->
<form action="pagey.cgi">
<select id="imgcode">
<option value="GSA01">First image</option>
<option value="GSA02">Second image</option>
<!-- ... more options ... -->
</select>
</form>

delvin
07-16-2005, 02:00 PM
thankyou so much for that and for the speedy response. :D

Twey
07-16-2005, 02:27 PM
Welcome :)

delvin
07-16-2005, 06:31 PM
Twey

I dont know if this is the only section of the forum you monitor or not, but have moved this thread to the javascript forum as requested and have put some follow on questions.

If at all possible, could you have a look for me

Many thanks again