For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > HTML::Template help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HTML::Template help
Mick I Hawkes

2005-03-29, 3:57 am

Hi all,=20

All i want is a pull down select to work. I can get it to display passed =
data but I just can't get it to return the selection. here is a code =
snippit (its inside a table) .=20

<td><select name =3D"TMPL_VAR NAME=3D"html_status">">=20
<option value =3D "<TMPL_VAR NAME=3D"html_status">" selected> <tmpl_var =
name=3D"HTML_Status">=20
<option value=3D"Open"> >Open=20
<option value=3D"Pending">Pending=20
<option value=3D"Closed">Closed </select></td>=20
</tr>=20

so why doesn't it work?=20

TIA=20

cheers=20
Mick Hawkes

Charles K. Clarkson

2005-03-29, 3:57 am

Hawkes, Mick I <mailto:Michael.I.Hawkes@team.telstra.com> wrote:

: All i want is a pull down select to work. I can get it to display
: passed data but I just can't get it to return the selection. here is
: a code snippit (its inside a table) .
:
: <td><select name ="TMPL_VAR NAME="html_status">">
: <option value = "<TMPL_VAR NAME="html_status">" selected> <tmpl_var
: name="HTML_Status"> <option value="Open"> >Open
: <option value="Pending">Pending
: <option value="Closed">Closed </select></td>
: </tr>
:
: so why doesn't it work?

What leads you to believe it doesn't work? Can we see a non-working
example which includes code?

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328

Mick I Hawkes

2005-03-29, 3:57 am



=09
Hawkes, Mick I <mailto:Michael.I.Hawkes@team.telstra.com> wrote:

: All i want is a pull down select to work. I can get it to display
: passed data but I just can't get it to return the selection. here is
: a code snippit (its inside a table) . =20
:=20
: <td><select name =3D"TMPL_VAR NAME=3D"html_status">">
: <option value =3D "<TMPL_VAR NAME=3D"html_status">" selected> =
<tmpl_var
: name=3D"HTML_Status"> <option value=3D"Open"> >Open
: <option value=3D"Pending">Pending
: <option value=3D"Closed">Closed </select></td>
: </tr>
:=20
: so why doesn't it work?

What leads you to believe it doesn't work? Can we see a non-working
example which includes code?

Doesn't work because there is nothing returned to the code.=20
This is the only relevant piece of the HTML code, if I was to include =
it all would only confuse the issue. Other text fields are used and =
returned without problem.=20
The code is very simple :

sub insertproject
{
my $self =3D shift; # get the passed parameters.
my $q =3D $self->query(); # get acopy of the CGI object.
my $dbh =3D $self->param('mydbh'); # get the database handle.

## Construct the SQL Statement
# Get the values from the form.
# my $HTML_OCLRef =3D $q->param("HTML_OCLRef");
# my $HTML_ProjectID =3D $q->param("HTML_ProjectID");
my $HTML_RespOfficer=3D$q->param("HTML_RespOfficer")||undef;
my $HTML_ProjectName=3D$q->param("html_projectname")||undef;
my $HTML_DateListed=3D$q->param("HTML_DateListed")||undef;
my =
$HTML_ProjectDescription=3D$q->param("HTML_ProjectDescription")||undef;
my $HTML_Priority=3D$q->param("HTML_Priority")||undef;
my $HTML_Status=3D$q->param("HTML_Status");
#my $HTML_Status=3D"Open";
my $HTML_AreaMgr=3D$q->param("HTML_AreaMgr")||undef;
my $HTML_Technology=3D$q->param("HTML_Technology")||undef;
my $HTML_Area=3D$q->param("HTML_Area")||undef;
my $HTML_FaultSource=3D$q->param("HTML_FaultSource")||undef;
my =
$HTML_FaultSourceContact=3D$q->param("HTML_FaultSourceContact")||undef;
my $HTML_DateCompleted=3D$q->param("HTML_DateCompleted")||undef;

# Setup and Query the database and find the max value of
# 'OCLRef' and store in $MaxOCLRef.
my $sqlstr =3D "SELECT Max(OCLRef) As MaxOCLRef FROM tblProjects;";
my $sth =3D $ dbh->prepare($sqlstr);
$sth->execute();
my @MaxOCLRef =3D $sth->fetchrow_array; #should return a table with =
one value.
........more code.......

As I said above all the other parameters are returned, this one , which =
is the only pulldown select I use, doesn't

Ibased on your comment, can I assume that the syntex of the HTML code =
correct ?]

HTH,

Charles K. Clarkson
--=20
Mobile Homes Specialist
254 968-8328


--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>

=09
Offer Kaye

2005-03-29, 3:57 am

On Tue, 29 Mar 2005 13:51:44 +1000, Hawkes, Mick I wrote:
> Hi all,
>
> All i want is a pull down select to work. I can get it to display passed data but I just can't get it to
> return the selection. here is a code snippit (its inside a table) .
>
> <td><select name ="TMPL_VAR NAME="html_status">">


You're missing a "<" before the "TMPL" here.

> <option value = "<TMPL_VAR NAME="html_status">" selected> <tmpl_var name="HTML_Status">


Why is the last "tmpl_var name" not in upper case, like your other
TMPL_VAR tags? Not that this is an error or something, but if you can,
you really should try to be consistant, it helps readability. Also,
are you sure you have both "html_status" and "HTML_Status" vars or is
this just a typo? In any case I personally think it's bad to have 2
template vars that are the same name except for case, but that's just
me ;-)

> <option value="Open"> >Open


This: ">Open" is probably a mistake. Should probably be "Open".

> so why doesn't it work?


No problem I can see with your template apart from the above comments.
Of course I would have to see your Perl code and final HTML output to
help you fully debug the problem, if the above fixes don't help.

--
Offer Kaye
Charles K. Clarkson

2005-03-29, 3:56 pm

Hawkes, Mick I <mailto:Michael.I.Hawkes@team.telstra.com> wrote:

[snipped code]

That code has nothing to do with the template (and it looks really
ugly -- use some white space).


: As I said above all the other parameters are returned, this one,
: which is the only pulldown select I use, doesn't
:
: Ibased on your comment, can I assume that the syntex of the HTML
: code correct ?


No, there are some syntax errors. Assuming 'HTML_Status' and
'html_status' are two different parameters passed to the template,
this should work.

<select name="<TMPL_VAR NAME="html_status">">
<option value="<TMPL_VAR NAME="html_status">" selected>
<tmpl_var name="HTML_Status">
<option value="Open">Open
<option value="Pending">Pending
<option value="Closed">Closed
</select>


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


















Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com