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 <[email protected]> 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 <[email protected]> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to