views:

45

answers:

1

Hello, my question is how would I use an HTML::Template tag inside a value of form field to change that field. For example

<table border="0" cellpadding="8" cellspacing="1">
        <tr> 
          <td align="right">File:</td> 
          <td>
        <input type="file" name="upload" value= style="width:400px">
          </td> 
        </tr> 
        <tr> 
          <td align="right">File Name:</td> 
          <td> 
            <input type="text" name="filename" style="width:400px" value=""  > 
          </td> 
        </tr> 
        <tr> 
          <td align="right">Title:</td> 
          <td> 
            <input type="text" name="title" style="width:400px" value="" /> 
          </td> 
        </tr> 
        <tr> 
          <td align="right">Date:</td> 
          <td> 
            <input type="text" name="date" style="width:400px" value="" /> 
          </td> 
        </tr> 
        <tr> 
         <td colspan="2" align="right"> 
           <input type="button" value="Cancel"> 
           <input type="submit" name="action" value="Upload" /> 
         </td> 
        </tr> 
      </table> 

I want the value to have a <TMPL_VAR> variable in it.

+4  A: 

You use it the same way you'd use a template variable anywhere else:

<input type="text" name="date" style="width:400px" value="<TMPL_VAR NAME=date>" /> 

Yeah, it's ugly and it breaks your HTML validator. Which is one of the many reasons why I like Template Toolkit better.

friedo
Beauty is in the eye of the beholder. Feeding XHTML to an HTML validator will not produce beautiful results either. And, in this particular case, why would there be any validation issue?
Sinan Ünür