Sponsored Content
Top Forums Shell Programming and Scripting Perl - radio button processing Post 302509369 by DGPickett on Wednesday 30th of March 2011 03:50:23 PM
Old 03-30-2011
Simple HTML Radio Buttons arrive in CGI just like any other form variable
Code:
name=value&name2=value2 . . . .

When they submit the form, and you parse out the form values, there it is, send back a new document with a form with a dynamically created list box.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl and refresh button, save twice?

Hi guys, I am writing a simple script save_me.cgi that can save the data in form.html into a txt (data.txt)file. But when user click "refresh" button one the browser on page save_me.cgi, the data will be save again in the data.txt. could someone help me on this issue? a studpid way... (3 Replies)
Discussion started by: gusla
3 Replies

2. UNIX for Dummies Questions & Answers

Script for using the Back button and the Close button

Here's a question I have for anyone that might be able to help me: I can write a html script that will allow the user to return to the previous page using the back button, and I can write a script that will allow the user to return to the previous page using the close button, but...is there a... (1 Reply)
Discussion started by: mdgibson
1 Replies

3. Shell Programming and Scripting

File processing on perl

Hey everyone ... I wanted to process the contents of a file, as in modify its contents. whats the best way to do it on perl? In more detail I hav to go through the contents of the file, match patterns n then modify the contents of the same file depending on the matching results. Any help is... (2 Replies)
Discussion started by: garric
2 Replies

4. UNIX for Dummies Questions & Answers

Changing middle mouse button for pasting to right mouse button in cygwin rxvt

Hi, I'm using rxvt in Cygwin and I'm wondering how to change my mouse bindings from the middle button for pasting to the right button. The main reason why I want to do this is because my laptop doesn't have a middle mouse button. Thanks for any help! (2 Replies)
Discussion started by: sayeo
2 Replies

5. Shell Programming and Scripting

Perl file processing

I have an input array like : "SVR1" GRP="EVT_BOX06B" SRID=100 MIN=2 "SVR1" GRP="EVT_BOX06B" SRID=200 MIN=1 "SVR2" GRP="ADM_BOX06B" SRID=100 MIN=1 "SVR1" GRP="EVT_BOX88B" SRID=100 MIN=2 "SVR1" GRP="EVT_BOX88B" SRID=200 MIN=1... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

6. Shell Programming and Scripting

include virtual perl-script - submit button opens a new page..

hello 2 all I can't understand how to insert a perl-script into .shml in a right way. <form> should be working but it's not doing that: <!--#include virtual="/cgi-bin/script.cgi?filename"--> filename is a name of the file which script is using the script is used for a score show (the number... (0 Replies)
Discussion started by: tip78
0 Replies

7. Web Development

include virtual perl-script - submit button opens a new page..

hello 2 all I can't understand how to insert a perl-script into .shml in a right way. <form> should be working but it's not doing that: <!--#include virtual="/cgi-bin/script.cgi?filename"--> filename is a name of the file which script is using the script is used for a score show (the number... (3 Replies)
Discussion started by: tip78
3 Replies

8. Shell Programming and Scripting

PARALLEL PROCESSING IN PERL

HI All, I have scenerio where I need to call sub modules through for loop for (i=0; i<30 ;i++) { .. .. .. subroutine 1; subroutine 2; } I want this to be run in parallel process1 { ... ... subroutine 1; subroutine 2; (0 Replies)
Discussion started by: gvk25
0 Replies

9. Shell Programming and Scripting

Create download button using perl CGI

Hi, I want to insert in a page a .html button that - once it is clicked - opens a save file dialog box by using perl CGI . I know that to create a link to do that I've done : print $cgi->p ( { -class => 'linc' },);I want to do something similar for a download button (0 Replies)
Discussion started by: black_fender
0 Replies

10. Shell Programming and Scripting

Perl - start search by using search button or by pressing the enter key

#Build label and text box $main->Label( -text => "Input string below:" )->pack(); $main->Entry( -textvariable => \$text456 )->pack(); $main->Button( -text => "Search", -command => sub { errchk ($text456) ... (4 Replies)
Discussion started by: popeye
4 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 09:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy