-----Original Message-----
From: Shawn Hinchy [mailto:[EMAIL PROTECTED] 

Would you mind sharing the answer?  I would assume it would have to be
some sort of Javascript, am I wrong?

Thanks,

Shawn
--------------------
Shawn Michael Hinchy
[EMAIL PROTECTED]


Nope, no Javascript. I could have used JS, but I was looking for a
server side solution, due to having to replace values in a textfield
with values gotten from a database in my "real" project.

I'm embarrassed to admit that it all boiled down to having a statement
out of order.
Here's the final code, which will replace the name 'richf' with the name
'John' in the textbox:

#!/usr/bin/perl -w
# This script is based on the example at the top of the CGI pod --richf;

use strict;
use CGI;

my $html = CGI -> new();

my $name = $html->param('name') || '';
$name = 'John' if ($name =~ /richf/i);         
$html->param(-name => 'name', -value => $name);        

print $html->header,  
      $html->start_html('A Simple Example'),  
      $html->h1('A Simple Example'),  
      $html->start_form,  

      "What's your name?",

      $html->textfield(-name  => 'name', -value => $name),       

      $html->p,  
      "What's the combination?",
      $html->p,  
      $html->checkbox_group(-name=>'words',        
                           -values=>['eenie','meenie','minie','moe'],
                           -defaults=>['eenie','minie']),
      $html->p,  
      "What's your favorite color?",
      $html->popup_menu(-name=>'color',
-values=>['red','green','blue','chartreuse']),  
      $html->p,  
      $html->submit,  
      $html->end_form,  
      $html->hr;  


print $html -> end_html;



HTH

richf

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to