Styles using the if-less if statement if it worked

I have this in_place_editor_field that I have the text showing up as red
if it contains a certain string such as ‘Click to Edit’

<%= in_place_editor_field ‘user’,‘w_cell’,{ :style => @user.w_cell ==
‘Click to
Edit’ ? ‘color:red’ : ‘’}, :cols=>20%>

But that text could also be ‘Check Format’ which I would also like to be
in red. I tried this and it didn’t work:

<%= in_place_editor_field ‘user’,‘w_phone’,{ :style => @user.w_phone ==
‘Click
to Edit’ ? ‘color:red;’ : @user.w_phone == "Check Format " ?
‘color:red;’ :
‘’}, :cols=>20%>

It doesn’t complain but it doesn’t do what I want it to do and that is
to color the text red if it matches any of the two aboved strings else
just have it black or normal. Any ideas of how I can get this to work?
Thanks all,

-S

On 18 Mar 2008, at 14:19, Shandy N. wrote:

I have this in_place_editor_field that I have the text showing up as
red
if it contains a certain string such as ‘Click to Edit’

<%= in_place_editor_field ‘user’,‘w_cell’,{ :style => @user.w_cell ==
‘Click to
Edit’ ? ‘color:red’ : ‘’}, :cols=>20%>
I think you’d be a lot better off just sticking that in a helper
function.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs