Sponsored Content
Full Discussion: Perl CGI forms
Top Forums Shell Programming and Scripting Perl CGI forms Post 302150034 by garric on Monday 10th of December 2007 12:32:26 AM
Old 12-10-2007
Is this supported in Perl CGI. The following piece of code did not generate the right HTML

print $display_form->input( -type=>"HIDDEN",
-name=>"group",
-value=>"$group");


The 'wrong' HTML that was generated was

<input>-type HIDDEN -name group -value EPG</input>
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl CGI.pm

my box is FreeBSD4.3 and I use Perl 5.0005_03. Here is the CGI script. test.cgi ...... if ($query->action eq 'detail') { ...... print $query->hidden('action', 'modify'); ...... } I found that the result of test.cgi?action=detail is not what I expected. the script does not... (4 Replies)
Discussion started by: tonyt
4 Replies

2. UNIX for Dummies Questions & Answers

Apache Perl/CGI

Can any body help me with apache and cgi i'dont know how iconfigure apache to use cgi... and when i try to start apachectl it says there is no file... please help me...i have apache installed... (1 Reply)
Discussion started by: CreamHarry
1 Replies

3. Shell Programming and Scripting

checkbox_group => CGI, Perl

Hi, In my cgi script(written in Perl using cgi.pm) i have a checkbox and i want all the items to be checked. Here is what i use: checkbox_group(-name=>'studenten_in_groep', -values=>\@member_keys, -defaults=>\@member_keys, -labels=>\%temp_members, -columns=>2), But no boxes are checked...... (18 Replies)
Discussion started by: tine
18 Replies

4. Shell Programming and Scripting

Grabbing web forms with Perl

Hello Everyone, I've googled everywhere for this with no luck and my brain hurts. I'm trying to write a program to take my webpages and search for forms. I've used LWP::Simple to store a website in $content I need to cut the form out of $content. I don't know how to do this seeing as how... (2 Replies)
Discussion started by: wibbs
2 Replies

5. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

6. Shell Programming and Scripting

CGI in Perl

Hi, Am unfamiliar with using CGI modules in Perl. Though i checked in few sites about CGI , i dint get a clear idea. Can anyone please explain me the purpose of these statements, it ll be very helpful to me #!/usr/bin/perl use CGI qw/:standard/; use Storable; use Data::Dumper; my... (1 Reply)
Discussion started by: irudayaraj
1 Replies

7. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

8. Shell Programming and Scripting

Perl CGI : unable to download the excel sheet from perl cgi page

Hi All, I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet. I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet. print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies

9. Shell Programming and Scripting

CGI Perl : while loop in CGI perl

Hi Team, I am trying to connect to database(succeeded ) and print the records on the browser using while loop. But the elements of array are not displayed instead while loop is displayed directly. Instead of the below I can embed html statements in print but I am looking for the below style as I... (1 Reply)
Discussion started by: scriptscript
1 Replies

10. OS X (Apple)

Perl CGI

I am trying to get my MacBook Pro with 10.8 Mt Lion set up to run Perl CGI scripts. Having a problem. I can start Apache Web Server with no problems. Why do I put the static and dynamic scripts? I which directory? I have looked at this article:... (3 Replies)
Discussion started by: djehresmann
3 Replies
CGI::FormBuilder::Template::Text(3pm)			User Contributed Perl Documentation		     CGI::FormBuilder::Template::Text(3pm)

NAME
CGI::FormBuilder::Template::Text - FormBuilder interface to Text::Template SYNOPSIS
my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', template => 'form.tmpl', variable => 'form', } ); DESCRIPTION
This engine adapts FormBuilder to use "Text::Template". Usage is very similar to Template Toolkit: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', # use Text::Template template => 'form.tmpl', } ); The default options passed into "Text::Template->new()" with this calling form are: TYPE => 'FILE' SOURCE => 'form.tmpl' DELIMITERS => ['<%','%>'] As these params are passed for you, your template will look very similar to ones used by Template Toolkit and "HTML::Mason" (the Text::Template default delimiters are "{" and "}", but using alternative delimiters speeds it up by about 25%, and the "<%" and "%>" delimiters are good, familiar-looking alternatives). The following methods are provided (usually only used internally): engine Returns a reference to the "Text::Template" object prepare Returns a hash of all the fields ready to be rendered. render Uses the prepared hash and expands the template, returning a string of HTML. TEMPLATES
<% $jshead %> - JavaScript to stick in <head> <% $title %> - The <title> of the HTML form <% $start %> - Opening <form> tag and internal fields <% $submit %> - The submit button(s) <% $reset %> - The reset button <% $end %> - Closing </form> tag <% $fields %> - List of fields <% $field %> - Hash of fields (for lookup by name) Note that you refer to variables with a preceding "$", just like in Perl. Like Template Toolkit, you can specify a variable to place fields under: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', template => 'form.tmpl', variable => 'form' }, ); Unlike Template Toolkit, though, these will not be placed in OO-style, dot-separated vars. Instead, a hash will be created which you then reference: <% $form{jshead} %> <% $form{start} %> etc. And field data is in a hash-of-hashrefs format: For a field named... The field data is in... -------------------- ----------------------- job <% $form{field}{job} %] size <% $form{field}{size} %] email <% $form{field}{email} %] Since "Text::Template" looks so much like Perl, you can access individual elements and create variables like so: <% my $myfield = $form{field}{email}; $myfield->{label}; # text label $myfield->{field}; # field input tag $myfield->{value}; # first value $myfield->{values}; # list of all values $myfield->{options}; # list of all options $myfield->{required}; # required flag $myfield->{invalid}; # invalid flag $myfield->{error}; # error string if invalid %> <% for my $field (@{$form{fields}}) { $OUT .= "<tr> <td>" . $field->{label} . "</td> <td>" . $field->{field} . "</td> <tr>"; } %> In addition, when using the engine option, you supply an existing Text::Template object or a hash of parameters to be passed to "new()". For example, you can ask for different delimiters yourself: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', template => 'form.tmpl', variable => 'form', engine => { DELIMITERS => [ '[@--', '--@]' ], }, data => { version => 1.23, author => 'Fred Smith', }, }, ); If you pass a hash of parameters, you can override the "TYPE" and "SOURCE" parameters, as well as any other "Text::Template" options. For example, you can pass in a string template with "TYPE => STRING" instead of loading it from a file. You must specify both "TYPE" and "SOURCE" if doing so. The good news is this is trivial: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', variable => 'form', engine => { TYPE => 'STRING', SOURCE => $string, DELIMITERS => [ '[@--', '--@]' ], }, data => { version => 1.23, author => 'Fred Smith', }, }, ); If you get the crazy idea to let users of your application pick the template file (strongly discouraged) and you're getting errors, look at the "Text::Template" documentation for the "UNTAINT" feature. Also, note that "Text::Template"'s "PREPEND => 'use strict;'" option is not recommended due to the dynamic nature for "FormBuilder". If you use it, then you'll have to declare each variable that "FormBuilder" puts into your template with "use vars qw($jshead' ... etc);" If you're really stuck on this, though, a workaround is to say: PREPEND => 'use strict; use vars qw(%form);' and then set the option "variable => 'form'". That way you can have strict Perl without too much hassle, except that your code might be exhausting to look at :-). Things like $form{field}{your_field_name}{field} end up being all over the place, instead of the nicer short forms. Finally, when you use the "data" template option, the keys you specify will be available to the template as regular variables. In the above example, these would be "<% $version %>" and "<% $author %>". And complex datatypes are easy: data => { anArray => [ 1, 2, 3 ], aHash => { orange => 'tangy', chocolate => 'sweet' }, } This becomes the following in your template: <% @anArray; # you can use $myArray[1] etc. %aHash; # you can use $myHash{chocolate} etc. %> For more information, please consult the "Text::Template" documentation. SEE ALSO
CGI::FormBuilder, CGI::FormBuilder::Template, Text::Template REVISION
$Id: Text.pm 100 2007-03-02 18:13:13Z nwiger $ AUTHOR
Copyright (c) Nate Wiger <http://nateware.com>. All Rights Reserved. Text::Template support is due to huge contributions by Jonathan Buhacoff. Thanks man. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. perl v5.14.2 2011-09-16 CGI::FormBuilder::Template::Text(3pm)
All times are GMT -4. The time now is 06:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy