Thanks for the advice Sami
In case anyone else is trying to do something similar, here is the jquery
code I used -
$(''div.risk'').each(function() {
var value = $.trim($(this).text());
var src;
switch(value) {
case ''Critical'':
src = ''/images/risk_high.png'';
break;
case ''Medium'':
src = ''/images/risk_med.png'';
break;
case ''Low'':
src = ''/images/risk_low.png'';
break;
case ''Information'':
src = ''/images/risk_info.png'';
break;
}
$img = $(''<img/>'').attr(''src'',
src);
$(this).html($img);
});
On Sun, Dec 6, 2009 at 1:38 PM, sami
<sszaman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> onchange of a select box you can use remote_function to call an action
> and user replace_html or on your rjs file to replace the html to show
> the jpg
>
>
>
>
> On Dec 6, 4:03 am, jayoshi13
<jayosh...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
> > Hi
> >
> > I''m developing my first rails application and would like
advice on how
> > to show a small image in a table cell based on a selection. This will
> > be based on a user selecting a Risk score from a select or check box
> > -
> >
> > high_risk = red.png
> > medium_risk = orange.png
> > low_risk = yellow.png
> > information = blue.png
> >
> > Thanks
> >
> > Jayoshi
>
>
>
> Syed Samiuzzaman
> software Engineer
> Code71 Inc (www.code71.com)
> product: www.scrumpad.com
> blog: samiuzzaman.blogspot.com
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.