JulianBThomas has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I am writing an Install program using CGI.pm and I want to display the current file being processed in a text field or text area.

as in when you press the submit button a textfield is created and this is then updated with the current value this is what I got that dosent work.

Is there a way I can change the value of the Textfield

if (param('Install')) { $SourcePassword = param('SourcePassword'); $SourceServer = param('SourceServer'); $DestPassword = param('DestPassword'); $DestServer = param('DestServer'); $RootPath = param('RootPath'); @InstallOptions = param('InstallOptions'); @Permissions = param('Permissions'); print p("Output Log:"); #print $q->textarea( -name=>'OutputLog', -rows=>10, -cols=>80); print $q->textfield( -name=>'OutputLog',-override => true, -value +=> 'test' ); param('OutputLog','New Value');

Replies are listed 'Best First'.
Re: Change Value of Textfield using CGI.pm
by Anonyrnous Monk (Hermit) on Jan 13, 2011 at 13:36 UTC

    Works fine for me:

    use CGI; my $q = CGI->new(); print $q->textfield( -name=>'OutputLog',-override => true, -value => ' +test' );

    Output:

    $ ./882118.pl <input type="text" name="OutputLog" value="test" /> ^^^^

    As you can see, the generated HTML text field has the value "test".

    Maybe your problem is somehow in the wider context you're using this snippet in...?  Could you provide a stripped down, but self-contained CGI script that demonstrates the issue you're having? (within <c>...</c> tags please)