Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to only show the buttons option if this sub named my_calls sets the value of "test" to true or "1". I dont understand why I am getting the error since I have the <TMPL_IF NAME="test"> tag in the .tmpl file. Could it be that the data coming from the database to populate the "data" tag loop is not yet ready?There has been an error: HTML::Template : Attempt to set nonexistent +parameter 'test' - this parameter name doesn't match any declarations + in the template file : (die_on_bad_params => 1)
And the portion of the .tmpl file# temp.pl ... sub my_calls { my $self = shift; my $q = $self->query; my $name = $q->param('name'); my $sql = "select * from my_taable where name = ?"; my $alldata = $self->_get_data($sql, $name); my $template = $self->load_tmpl('mytemp.tmpl'); $template->param('data', $alldata ); $template->param('test' => 1); return $template->output(); } ...
# mytemp.tmpl ... <form action="" method="post"> <tmpl_loop name=data> <tr> <td align="center"> <input type="checkbox" class="checkbox" name="confirm" value +="n" <tmpl_var name=checked>> </td> <td align="center"> <span id="id_<tmpl_var name=order>"> <tmpl_var name=number> </ +span> </td> <TMPL_IF NAME="test"> <table border="1" width="170" cellspacing="0" cellpadding="0"> <tr> <td> <input name="btnSave_<tmpl_var name=id>" type="button" + value="Save" id="btnSave_<tmpl_var name=id>""> <input name="btnEdit_<tmpl_var name=id>" type="button" + value="Edit" id="btnEdit_<tmpl_var name=id>""> <input name="btnDelete_<tmpl_var name=id>" type="button" + value="Delete" id="btnDelete_<tmpl_var name=id>""> </td> </tr> </table> </TMPL_IF> </td> </tr> </tmpl_loop> </form> ...
|
|---|