Form Maker

This is an application that creates a form in HTML depending on user specs

<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Online Form Maker</title>

<script>
window.windowname= "Add Form Page"
orpage= window.windowname
function startForm(form) {
nname= form.fname.value;
nname= ((nname== "") ? nname= "" : nname= " NAME=" + nname);
ntarget= form.ftarget.value;
ntarget= ((ntarget== "") ? ntarget= "" : ntarget= " TARGET=" + ntarget);
nenctype= form.fenctype.value;
nenctype= ((nenctype== "") ? nenctype= "" : nenctype= " ENCTYPE=" + nenctype);
whtml= form.HTML.value;
mymethods= form.chosenmethod.selectedIndex;
mymethodsarray= new Array();
mymethodsarray[0] = "";
mymethodsarray[1] = "GET";
mymethodsarray[2] = "POST";
mymethod= mymethodsarray[mymethods];
mymethod= ((mymethod== "") ? mymethod= "" : mymethod= " METHOD=" + mymethod);
myaction= form.chosenaction.value;
myaction= ((myaction== "") ? myaction= "" : myaction= " METHOD=\"" + myaction + "\"");
nhtml= whtml + "\r <FORM" + nname + myaction + mymethod + ntarget + nenctype + ">";
form.HTML.value = nhtml;
}
function endForm(form) {
whtml= form.HTML.value;
nhtml= whtml + "\r </FORM>";
form.HTML.value = nhtml;
}
function newItem(txtarea, form) {
addbre= (form.addbr.checked== true) ? addbre=form.addbr.value : addbre= "";
crows= form.chooserows.value;
ccols= form.choosecols.value;
crows= ((crows== "") ? crows= "" : crows= " ROWS=" + crows);
ccols= ((ccols== "") ? ccols= "" : ccols= " COLS=" + ccols);
ntoit= form.choosevalue.value;
cname= form.choosename.value;
cname= ((cname== "") ? cname= "" : cname= " NAME=\"" + cname + "\"");
ctype= form.choosetype.selectedIndex;
ctypearray= new Array();
ctypearray[0] = "text";
ctypearray[1] = "radio";
ctypearray[2] = "checkbox";
ctypearray[3] = "button";
ctypearray[4] = "hidden";
ctypearray[5] = "reset";
ctypearray[6] = "submit";
ctypearray[7] = "password";
ntoit= ((0 < ctype) ? ntoit= ntoit : ntoit= "");
ntoit= ((ctype > 2) ? ntoit= "" : ntoit= ntoit);
check= form.checks.value
checktf= form.checks.checked
check= ((ctype== 2) | (ctype== 1) ? check= check : check= "")
check= (checktf== true) ? check= check : check= "";
cvalue= form.choosevalue.value;
cvalue= ((cvalue== "") ? cvalue= "" : cvalue= " VALUE=\"" + cvalue + "\"");
csize= form.choosesize.value;
csize= ((ctype== 7) | (ctype== 0) ? csize= csize : csize= "")
csize= ((csize== "") ? csize= "" : csize= " SIZE=" + csize);
clength= form.chooselength.value;
clength= ((clength== "") ? clength= "" : clength= " MAXLENGTH=" + clength);
clength= ((ctype > 0) ? clength="" : clength= clength);
whtml= form.HTML.value;
ctype= " TYPE=\"" + ctypearray[ctype] + "\"";
nhtml= whtml + "\r <INPUT" + check + cname + ctype + cvalue + csize + clength + ">" + ntoit + addbre;
txtdsply= "Default Text"
nwhtml= whtml + "\r <TEXTAREA" + cname + crows + ccols + ">" + txtdsply + "</TEXTAREA>" + addbre;
nhtml= ((txtarea== 8) ? nhtml= nwhtml : nhtml= nhtml);
form.HTML.value = nhtml;
}
function genNewPage(form) {
header= "<HTML>\r<HEAD>\r<TITLE>Generated Form</TITLE>\r</HEAD>\r\r<BODY BGCOLOR=\"white\">";
newhtml= form.HTML.value;
footer= "</BODY>\r</HTML>";
newpage= header + "\r\r" + newhtml + "\r\r" + footer;
preWin= open("", "Preview", "width=400,height=400,status=no,toolbar=no,menubar=no");
preWin.document.open();
preWin.document.write(newpage);
preWin.document.close();
}
</script>

<base target="leftframe">
</HEAD>
<BODY>
<TABLE WIDTH="100%" HEIGHT="40" BORDER="0" BGCOLOR="#FFFFFF" BORDERCOLOR="#FFFFFF">
<TR>
 <TD><FONT SIZE=3 COLOR=Blue FACE="Arial,Helvetica,Times New Roman"><CENTER><STRONG>FORM MAKER</STRONG></CENTER></FONT>
<BR>
<CENTER><table WIDTH="96%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
<tr>
<td WIDTH="100%"><FONT SIZE=2 FACE="Arial,Helvetica,Times New Roman"><STRONG><CENTER>Make your own feedback form with FormMaker:</CENTER></STRONG></FONT> <font
FACE="ARIEL,HELVETICA, TIMES NEW ROMAN" SIZE="-1"><form NAME="addform">
<p>Form options:</p>
<p>Name: <input NAME="fname" TYPE="text" size="20">

Action: <input TYPE="text" NAME="chosenaction" size="20">

Method: <select NAME="chosenmethod" SIZE="1">
<option SELECTED>none </option>
<option>GET </option>
<option>POST </option>
</select>

Target: <input NAME="ftarget" TYPE="text" VALUE="code" size="20">

Enctype: <input NAME="fenctype" TYPE="text" size="20">

</p>
<p><input VALUE="Start Form" TYPE="button" NAME="start"
onClick="startForm(document.addform)"> <input VALUE="End Form" TYPE="button" NAME="end"
onClick="endForm(document.addform)"></p>
<p>Description of form item to add:</p>
<p>Type:<select NAME="choosetype" SIZE="1">
<option SELECTED>Text Field </option>
<option>Radio Button </option>
<option>Check Box </option>
<option>Button </option>
<option>Hidden </option>
<option>Reset </option>
<option>Submit </option>
<option>Password </option>
<option>Text Area </option>
</select>

Value:<input NAME="choosevalue" TYPE="text" VALUE size="20">

Name:<input NAME="choosename" TYPE="text" VALUE size="20">

Size:<input NAME="choosesize" TYPE="text" VALUE size="20">

Maximum Length:<input NAME="chooselength" TYPE="text" VALUE size="20">

Rows:<input NAME="chooserows" TYPE="text" VALUE size="20">

Columns:<input NAME="choosecols" TYPE="text" VALUE size="20">

<input NAME="addbr" TYPE="checkbox" VALUE="<BR>">Add <BR> tag after form item?

<input NAME="checks" TYPE="checkbox" VALUE=" CHECKED">Is checkbox/radio button checked?</p>
<p><input VALUE="Add Item" TYPE="button" NAME="additem"
onClick="newItem(document.addform.choosetype.selectedIndex,document.addform)"></p>
<p>HTML:

<textarea NAME="HTML" ROWS="10" COLS="45"></textarea></p>
<p><input VALUE="Reset" TYPE="reset" NAME="reset"> <input VALUE="Preview" TYPE="button"
NAME="preview" onClick="genNewPage(document.addform)"> </font></p>
</form>
</td>
</tr>
</table></CENTER>
<!--content stop-->
<BR><BR>

</TD>
</TR>
</TABLE>

</BODY>

</HTML>

Views 735 Downloads 362

''

JeffSmith
26
Layout+Design JS+JQuery
Revisions

v1.0