# Assign named placeholder to a variable (as a string)

If I want to assign a regular placeholder as a string, it's very easy: (anything the user types in will automatically be given quotes around it, so when they evaluate the cell str is a string)

 str = "\[Placeholder]"


I just can't get quotes around a named placeholder (not while assigning to a variable, at least):

 str2 = {"\"", Placeholder[ProjectName], "\""}


Any help would be appreciated, thanks in advance!

-
I've got it, apologies for the self-answered post. It was treating the "=" as a string that caught me off guard. MakeBoxes[string ], RowBox[{"=", "\"", ToBoxes@Placeholder[enter here], "\""}] – user15921 Jun 17 '14 at 14:10
I can't yet, too few rep :( If you'd like, take it and answer in my stead! – user15921 Jun 17 '14 at 14:31
How about now? 6 rep should be enough.. :) – Öskå Jun 17 '14 at 14:32
Thank you very much! Unfortunately, "Users with less than 10 reputation can't answer their own question for 8 hours after asking. " – user15921 Jun 17 '14 at 14:35

It was treating the "=" as a string that caught me off guard.

NotebookWrite[InputNotebook[],
Cell[BoxData[
RowBox[{MakeBoxes[string],
RowBox[{"=", "\"", ToBoxes@Placeholder[enter here], "\""}]
}]
]]
]


-
Even if your code helped you to answer your own question, it doesn't seem to work for me. Can you please fix it? – Öskå Jun 17 '14 at 16:38
Sorry, I'll add full context. In my own code this is written to a new notebook, where the user fills in the placeholder and evaluates to save their input as the variable string. – user15921 Jun 17 '14 at 18:39

x = "";

Appending FieldHint -> "Enter Project Name", FieldHintStyle -> Red would make your answer, which is nice, nicer :) – eldo Jun 17 '14 at 22:09