title: How do you put a string variable in the confirm() function in Javascript/HTML?
body: <p>I am trying to confirm with the user if the following string he or she is about to enter is correct but the confirmation box won't appear. Here is that segment of the code:</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html"&gt;
  &lt;head&gt;
  &lt;script&gt;
     function validateForm(){
        var pkey = document.forms["createProductForm"]["pagekeyTF"].value;
        var agree = confirm("Is this your product?\n\n ${pkey}");
  
        if(agree) //Do something
        else //Do something else
     }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;form name="createProductForm" controller="actions" action="ImplementNewProduct" onsubmit="return validateForm()" method="post"&gt;
  
        &lt;g:textField id="productTF" name="productTF" value="My Product" /&gt;       
        &lt;button id="createProductID" name="createButton" value="Create Product"&gt;Create Product&lt;/button&gt;
  
     &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Am I not allowed to pass in string variables in the confirmation function? Because if I take off the <code>${pkey}</code> it works fine but it does not include the user's input and that is not what I am not trying to achieve. Any help? Thanks!</p>