开发者

rails select one image from list of images

i have image collection

  @images = 开发者_如何学GoImage.find(:all)

and displaying it like this

  <%@images.each do|image|%>

  <%= image_tag image.photo.url(:original), :id=>image.id, :class=>'image' %>

  <%end%>

but, i want to put images as list and select one of the image before submitting the form,

i there any way to put these images in to selectbox.. or is there any other approach to select image from list of image

please guide me with solution

thanks


This is more of an html, css, javascript question than a Rails specific one.

How about a list of checkboxes representing the chosen image, with the actual images within the corresponding labels. That way clicking on an image will highlight the appropriate checkbox to be submitted. Now your functionality should be complete.

Then you can use a combination of javascript and css to hide the checkboxes and ensure the selected image is visually highlighted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜