Mark Woodward
3/21/2008 2:57:00 AM
Hi Shandy,
On Thu, 20 Mar 2008 09:01:48 -0500
Shandy Nantz <shandybleu@yahoo.com> wrote:
> I asked this on the rails side of this forum but didn't get a response
> and while I am using the code in a rails app I think that this is a
> ruby question.
>
> In a helper that I am using, I am seeing if a phone # gets entered
> correctly, if not default text is entered in it's place and displayed
> in red.
>
> <%= in_place_editor_field 'user','w_phone',{ :style => @user.w_phone
> == 'Click
> to Edit' ? 'color:red;' : ''}, :cols=>20%>
>
> This highlets everything in that comes through with 'Click to Edit' in
> red. But what I would like to do is to hightlight everything in red if
> the string says either 'Click to Edit' of 'Check Format'. So I tried
> this:
>
> <%= in_place_editor_field 'user','w_phone',{ :style => @user.w_phone
> == 'Click
> to Edit' ? 'color:red;' : @user.w_phone == "Check Format " ?
^^
I think what David's asking is do you really want to be include those
2 spaces in any comparison?
"Check Format ", and "Check Format" are different.
> 'color:red;'
> : ''}, :cols=>20%>
>
> This codes executes fine but it doesn't show the 'Check Format' part
> as red, so I'm thinking that I don't have the conditions set up wrong.
> Anyone have any suggestions? Thanks,
>
> -S
cheers,
--
Mark