Mike,

Thank you so much for giving me the pointer.

The comment textarea now shows 'project on track' using
<textarea name="comment"><tmpl_var name="comment"></textarea>

I'm still struggling with the 'project' select list. I tried to place
<tmpl_var name="project"> at various spots but none worked.

# attempt 1 that didn't work
<select name="project">
   <option value="project_1">Project 1</option><tmpl_var name="project">
   <option value="project_2">Project 2</option><tmpl_var name="project">
   <option value="project_3">Project 3</option><tmpl_var name="project">
</select>

# attempt 2 that didn't work
<select name="project">
   <option value="project_1"><tmpl_var name="project">Project 1</option>
   <option value="project_2"><tmpl_var name="project">Project 2</option>
   <option value="project_3"><tmpl_var name="project">Project 3</option>
</select>

# attempt 3 that didn't work
<select name="project"><tmpl_var name="project">
   <option value="project_1">Project 1</option>
   <option value="project_2">Project 2</option>
   <option value="project_3">Project 3</option>
</select>

# attempt 4 that didn't work
<select name="project">
   <option value="project_1">Project 1</option>
   <option value="project_2">Project 2</option>
   <option value="project_3">Project 3</option>
</select><tmpl_var name="project">

Was my syntax off or did I miss more than that?

Thanks!

Bob

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On
Behalf Of Mike Williams
Sent: Thursday, June 25, 2009 12:48 AM
To: [email protected]
Subject: Re: [Boston.pm] CGI and HTML-Template question

On Wed, Jun 24, 2009 at 10:23 PM, Bob Xiong
<[email protected]>wrote:

> I'm using CGI and HTML-Template for a web project (to allow user to
> update info for a database record). Here is a sample code snippet from
> the cgi script and the template.
>
> # from cgi script
>
> My $t=HTML::Template->new(filename=>'/path_to_template_file');
> ^^ my
> $t->param(fname=>$name_retrieved_from_database); # 'Scott'
> $t->param(project=>$project_number_retrieved_from_database); #
'Project 2'


there is no reference to project in the template - (no tmpl_var
xxx="project") in the option list

$t->param(comment=>$comment_retrieved_from_database); # 'project on
track'
>
> # from template
> <input type="text" name=""fname" value="<tmpl_var name="fname">">
> <select name="project">
>   <option value="project_1">Project 1</option>
>   <option value="project_2">Project 2</option>
>   <option value="project_3">Project 3</option>
> </select>

<textarea name="comment" value="<tmpl_var name="comment">"></textarea>
>

BUG - the above line will generate something like:
<textarea name="comment" value="project on track"></textarea>

the "project on track" will only be visible if you do View/Source, not
in
the browser window,
you need the variable contents within the <textarea> .... </textarea>
tags

<textarea name="comment"><tmpl_var name="comment"></textarea>

Mike

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to