Syntax is killing me! instance var in labels

Hi:

I’ve got a text field tag with a value. In that value, I want to use a
local variable. I can’t seem to get the syntax right. Here’s what I’ve
tried:

<%= text_field_tag(‘step_1’, ‘enter Task’ @tasks ‘here’, {}) %>

and this:

<%= text_field_tag(‘step_1’, ‘enter Task #{@tasks} here’, {}) %>

And

<%= text_field_tag(‘step_1’, ‘enter Task @tasks here’, {}) %>

Any help you could provide would be greatly appreciated. Thanks!

Mike

<%= text_field_tag(‘step_1’, “enter Task #{@tasks} here”, {}) %>

you need to use double quotes for the string to be evaluated

-j

Hi Mike,

#2 should work if you replace the single quotes with double. Single
quotes
mean you want whatever’s inside to be treated literally. If that
doesn’t
fix it, it would help to see what results you’re getting.

Best regards,
Bil

see Ruby | zenspider.com | by ryan davis for a
lesson on string interpolations