Hawkes, Mick I <mailto:[EMAIL PROTECTED]> wrote:
: Here is the test page: : : <!-- test.tmpl.htm --> : <!-- This form must return a NAME attribute='rm' with a VALUE : attribute = 'mode_1 or 'mode_2' or 'mode_3'. --> Oh, you're one of those no DOCTYPE people, huh. :) : <html> [snipped helpful code. : status:<select name ="<TMPL_VAR NAME="HTML_Status">"> That should be: status:<select name="HTML_Status"> : <option value = "<TMPL_VAR NAME="HTML_Status">" selected> <tmpl_var name="HTML_Status"> That should be (note the missing spaces): <option value="<TMPL_VAR NAME="HTML_Status">" selected><tmpl_var name="HTML_Status"> Better: <option value="<TMPL_VAR NAME="HTML_Status">" selected><tmpl_var name="HTML_Status"></option> : <br> : * denotes a manditory field : The form never ends. </form> : </body> : </html> : : All the code does is read in the data and then sent it back to the : page. All the other textboxs work except for you know who! : : Anyway here is the code that I process this with Please don't shoot the messenger, but you're doing a lot unneeded typing. It looks like you are inside a CGI::Application script. All you need to do is associate the query object to populate the form. Read the HTML::Template docs for details. sub insertproject { my $self = shift; # Setup the template to use for the output. my $q = $self->query(); my $template = $self->load_tmpl( 'test2.tmpl.htm', associate => $q, die_on_bad_params => 0, ); ## Construct the SQL Statement and add results to template # my $dbh = $self->param('mydbh'); # Output the template... return $template->output; } : I don't see why this doesn't work, but I have been frustrated like : this before with this type of code (HTML::Template) where code that : should work just doesn't then all of a sudden it does! For no reason : that I can see or duplicate! I'm starting to this is a really dodgy : module. The HTML::Template module is very well tested. The errors were in the template, but I needed to testing to find the error. Had you presented a way to test your problem, we could have helped you solve it faster. I find many of my problems while constructing such a test platform. To test your code snippet I created a slightly altered form and a module named foo.pm. With the changes above, things seem to be working fine. package foo; use base 'CGI::Application'; use CGI::Carp 'fatalsToBrowser'; sub setup { my $self = shift; $self->start_mode( 'app_start' ); $self->run_modes( [ qw( app_start insert_project ) ] ); } sub app_start { my $self = shift; my $template = $self->load_tmpl( 'in.html' ); # Set all template parameters to '' my @parameter_names = $template->param(); my %params; @params{ @parameter_names } = ('') x @parameter_names; # Confirm certain values $params{ HTML_Status } => 'foo'; # Add new values to template $template->param( \%params ); return $template->output; } sub insert_project { my $self = shift; # Setup the template to use for the output. my $q = $self->query(); my $template = $self->load_tmpl( 'in.html', associate => $q, die_on_bad_params => 0, ); ## Construct the SQL Statement and add results to template # my $dbh = $self->param('mydbh'); # Output the template... return $template->output; } 1; HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>