Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

images as radio buttons

Community Beginner ,
Jan 21, 2010 Jan 21, 2010

I am attempting to use cfinput type="image" to use three different images as choices for a user to select in place of radio buttons. But if you click the image, it submits the form. Is it not possible to use an image as anything other than the submit button?  I thought I would need to use an onclick event (or onChange) but even when putting something simple in, it still submits.

I tried searching the CF 8 and CF9 documentation but am not finding anything on this. I am using CF8 and CF9. Is this not possible even with CF9?

Here's the sample, this is all within cfform tags

<cfinput type="image" src="images/ball_green_letter.jpg" name="costcolor" value="g" onclick="this.innerHTML='green!'">

If this is possible, can someone refer me to some documentation or show me a sample for the onClick or onChange event so I can get it to retain the value while the user fills out the rest of the form?

When it does submit, I have a cfdump tag to reveal all form contents and what I'm getting for this value is

COSTCOLOR.X7
COSTCOLOR.Y5

Not sure why it sends something that looks like x,y coordinants and why it submits two values for one form item? Maybe this will be resolved when I figure out what I'm doing...

Thanks for the help

654
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 23, 2010 Jan 23, 2010
LATEST

I am attempting to use cfinput type="image" to use three different images as choices for a user to select in place of radio buttons. But if you click the image, it submits the form. Is it not possible to use an image as anything other than the submit button?

No, and I wouldn't use it for anything else, even if that was possible in Coldfusion. It isn't Coldfusion's choice to make, as <input type="image"> is an HTML standard for a submit button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources