Created
December 14, 2012 03:42
-
-
Save JGallardo/4282555 to your computer and use it in GitHub Desktop.
Ruby script to generate a form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cgi' | |
cgi = CGI.new("html4Tr") | |
print "Enter Form Page Title: " | |
title = gets.chomp | |
print "Enter Head Title: " | |
input_title = gets.chomp | |
print "Enter value for button: " | |
value = gets.chomp | |
print "Enter group: " | |
group = gets.chomp | |
$stdout = File.new("form.html", "w") | |
cgi.out{ | |
CGI.pretty( | |
cgi.html{ | |
cgi.head{ "\n"+cgi.title{title}}+ | |
cgi.body{"\n" + | |
cgi.form{"\n" + | |
cgi.hr + | |
cgi.h1 { "#{input_title}:" } + "\n" + | |
cgi.br + | |
cgi.checkbox(group, value) + value + cgi.br | |
cgi.br + | |
cgi.textarea("input",80,5) + "\n" + | |
cgi.br + | |
cgi.submit("Send") | |
} | |
} | |
} | |
) | |
} | |
$stdout.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment