Why won't this work - simple helper text?

Trying to print this out and it fails,

def cancel_toggle(element)
‘<a href="#" onclick=“new Effect.toggle(”’ + element + ‘",“blind”,
{duration: 0.4}); return false;" >Add a New Client’
end

When called in my view like this:
<%= cancel_toggle “newClient” %>

It gets written to the browser but does not work. When placed directly
in the view it works. Firefox highlights the following in red (in source
view):

newClient",“blind”

It must be something to do with my quotes but I cannot see it. Help
please ???

James W. wrote:

It gets written to the browser but does not work. When placed directly
in the view it works. Firefox highlights the following in red (in source
view):

newClient",“blind”

It must be something to do with my quotes but I cannot see it. Help
please ???

Add a New Client

should work. You had the same quote around the onclick attribute as
around the javascript strings.

Alex Y. wrote:

James W. wrote:

It gets written to the browser but does not work. When placed directly
in the view it works. Firefox highlights the following in red (in source
view):

newClient",“blind”

It must be something to do with my quotes but I cannot see it. Help
please ???

Add a New Client

should work. You had the same quote around the onclick attribute as
around the javascript strings.

Thanks, I actually got it to work using this:

“<a href=”#" class =“redLink” onclick=“new
Effect.toggle(’#{element}’,‘blind’, {duration: 0.4}); return false;”

cancel"

Your looks a little neater though. Thanks again.

On 13-Apr-06, at 4:39 AM, James W. wrote:

It must be something to do with my quotes but I cannot see it. Help

"<a href="#" class ="redLink" onclick="new
Effect.toggle(‘#{element}’,‘blind’, {duration: 0.4}); return false;"

cancel"

Your looks a little neater though. Thanks again.

Hi James,

If you’re willing to put up with extra noise at the beginning of your
string you can get rid of the backslashes. This string is equivalent
to yours:

%Q|cancel|

… and in case it gets mangled in the mail, it’s percent Q pipe at
the start of the string and pipe at the end.

Regards,
Trevor

Trevor S.
http://somethinglearned.com