View Full Version : help with images

07-21-2010, 09:42 PM
Good afternoon I am trying to make a form and keep getting stuck on one thing, don't know if JavaScript is the way to go so any advise would be helpful.
basicly i have a form
giftcert.html -that has text input boxes the user fills in and a link to the next page for the user to pick a gift card
giftcards.asp -the user picks a gift card by radio buttons (over 100)grouped by name and then pushes a button to take them to the next page passing the value of the radio and image (here is the issue)
giftcert.asp -this page displays the text boxes from the first page with the value already present (used asp to achieve) and the value of the radio button (a stock number - used asp to achieve) and i want a sample of the image attached to the stock number.
how do i pass the image attached to the radio button from giftcards.asp to giftcert.asp
i don't know where i am going wrong
a) how do i attach the image to the button do i use an onclick="pass src" and how
b) how do i get the image to show up in giftcert.asp

07-21-2010, 10:07 PM
Radio buttons are inputs - they have values. The values are passed to the next form in the chain. Associate the values with the images.

07-21-2010, 10:54 PM
but the values with the radio buttons are already there with a stock number (example bba-003) that goes to a text box on the next page with asp.
i need to have the image go also to the next page to a diff location on the page
this is way i am lost

is there a way of assigning two values to a radio button?

07-22-2010, 01:11 AM
No, but you can associate the values with the image filenames in your ASP code. So, if you get bba-003 as the value, then you can use the filename little_blue_teapot.jpg, or whatever. Otherwise, you could pass all of the filenames in hidden inputs.

Old Pedant
07-22-2010, 01:58 AM
You *could* do this:

<input type="radio" name="whatever" value="173::heartsAndLions.jpg" />
<img src="images/heartsAndLions.jpg" /></label>

<input type="radio" name="whatever" value="401::bunnies.jpg" />
<img src="images/bunnies.jpg" /></label>

... etc. ...

And then, in the subsequent ASP page, you would do:

temp = Split( Request("whatever"), "::" )
If UBound(temp) = 1 Then
cardNumber = CINT(temp(0))
imageName = temp(1)
End If

Nobody ever said you couldn't send more than one piece of information as the value= of a form field, you know.

07-22-2010, 01:58 AM
i would like to try but dont know how to go about associating the values with the image filenames in my ASP code,
because i was trying to pass hidden inputs but cant get it to work with the radio buttons

07-22-2010, 02:13 AM
i tried to put it into plan but got this error

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'CINT'

/index/GIFTCERTIFICATE.asp, line 500

plus the image is already placed in the table the row above.

maybe you can see something i don't see or the more likely story just don't understand
so i included the links
page 1
no issues from pg 1 to 2

page 2
issues are from 2 to 3

page 3 - end page before submit

Old Pedant
07-22-2010, 02:15 AM
You wrote both pages, didn't you?

How did you associate a particular image with a particular radio button on the page where both are showing???? Why can't you do the same thing on the page the <form> posts to?

Anyway, I don't see how I can make any further guesses without seeing your code.

And I seriously doubt that this thread belongs in the JavaScript forum, in any case.

Old Pedant
07-22-2010, 02:22 AM
Spoke too soon. LOL.

Okay, but even on the first page I get a whole series of JavaScript errors.

This line, for example:

var gsn = (location.href.split('giftcardstocknumber=')[1].split('&')[0]).replace(/\+/g,' ');

CLEARLY the url (according to the address bar) is simply:

so there is no "giftcardstocknumber=" to split on! So clearly you can't get the [1] element of the non-existent array that results from the split.

Firebug also complains about

$mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu"
but that's jQuery, I guess, and I don't know what is wrong there.

07-22-2010, 02:32 AM
I put the links up
i did not associate the radio button and image they are both in a table layout
as far as names the image is named GIFTCARDS/003 BASIC FLOWER.jpg
and the radio button is named giftcardstocknumber with a value of bba-003

as for this code in giftcert.html i have to remove it. it was one of the things i was trying to get the first form to work before i went to asp.

var gsn = (location.href.split('giftcardstocknumber=')[1].split('&')[0]).replace(/\+/g,' ');

Old Pedant
07-22-2010, 02:39 AM
This code makes no sense:

<td><span class="style71"><label><input name="giftcardstocknumber" type="radio" value="BBA - 004"
/>Style-<input type="hidden" id="bba004" name="pickimage" value="GIFTCARDS/004 BASIC4.jpg"/>BBA 004</label></span>

Those hidden fields, all with the same name (pickimage) are useless.

On the next ASP page, if you do

pickimage = Request("pickimage")

you are going to get a list of *EVERY SINGLE ONE* of those, in the form:

GIFTCARDS/004 BASIC4.jpg, GIFTCARDS/005 BASIC5.jpg, ...all of them...

Totally useless.

Old Pedant
07-22-2010, 02:40 AM
Well, I have to go now. Look at my suggestion for the value= of your radio buttons. It's really by far the simplest way.