Pages:Custom Forms

From Whirlwind eCommerce Wiki
Revision as of 20:26, 31 October 2008 by 71.163.185.8 (Talk)

Jump to: navigation, search

Custom forms allow page content managers to create forms on the fly in the WYSIWYG editor. A knowledge of HTML form coding is required to do this. When a custom form is submitted by a website visitor, it is emailed to specified recipients (using the emailTo field below) AND it is placed into the database accessible via Form Submissions in system administration.

Each form has required hidden fields, core fields and custom fields:

REQUIRED HIDDEN FIELDS

Required hidden fields send data to the system that tells it how to process the form. The required hidden fields are as follows:

fa
This field should ALWAYS have a value of "USER.formSubmit" - which tells the system this is a custom form that needs to be processed.
formType
This field's value is used to classify and organize the form submissions made through this form. For instance, enter "newsletter" as the value if this form is being used to register for the newsletter; or enter "catalog request" as the value if this is a catalog request form. This value can later be used when looking up the form in Form Submissions so you can filter only certain forms.
emailTo
A comma delimited list of email addresses that will receive this form's contents upon submission. Use to send yourself and others notifications of these forms as they are submitted. Leave empty if there are no recipients.
redirect
The URL where the visitor should be directed to following submission of the form. For each custom form it is recommended you create an accompanying page that will display a thank you or confirmation message. This page should be where the visitor is directed to using the 'redirect' field following form submission.
otherFields
A comma delimited list of custom field names. Leave empty if no custom fields are being used.

CORE FIELDS

Core fields are visitor-populated fields that can be used to organize and classify form submissions. The emailAddress field in particular is required if you wish to include the subscribe option (which allows visitors to subscribe to the newsletter when this form is submitted).

firstName
A text field with a maxlength of 50
lastName
A text field with a maxlength of 50
emailAddress
A text field with a maxlength of 255
subscribe
A checkbox with a value of 1 (if checked, this will pass and trigger the newsletter registration process for the entered emailAddress)

CUSTOM FIELDS

Custom fields allow the content manager creating the form to add any number of additional form fields that will be stored upon submission. Note that form submissions cannot be searched or filtered by the contents of these fields, but they are present when looking up submitted forms and are listed in exports of form submissions (which are then sortable by the custom fields in Excel). Custom fields can have any name EXCEPT the reserved CORE and REQUIRED HIDDEN field names (fa,formType,emailTo,redirect,firstName,lastName,emailAddress,subscribe,otherFields). All custom field names MUST be entered into the hidden field "otherFields" (see REQUIRED HIDDEN FIELDS above)


EXAMPLES

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


<!-- start our form -->
<form action="index.php" method="POST">

<!------------------------>
<!--- HIDDEN FIELDS ---->
<!------------------------>

<!-- the formType field attached a 'category' to this form when submitted. 
If you have multiple custom forms on your website, this helps to easily search, filter and group form submissions
ideas for this are: newsletter, catalog request, contact us, feedback... -->
<input type="hidden" name="formType" value="this form">

<!-- the emailTo field allows you to enter recipients of this forms contents
When the form is submitted, the contents will be sent to the email addresses in this field -->
<input type="hidden" name="emailTo" value="email@website.com,anotheremail@website.com">

<!-- the fa field tells the websiteto process this form on submission -->
<input type="hidden" name="fa" value="USER.formSubmit">

<!-- the redirect field tells the website where to put the visitor after the form has been procesed -->
<input type="hidden" name="redirect" value="index.php?pageId=123&message=Thank you for filling our our form">

<!--------------------->
<!-- CORE FIELDS ------>
<!--------------------->

<!-- first name, last name and email fields are CORE form fields
but are optional - you do not have to include these fields, but if you do,
make sure you use the correct names -->
<br>First Name: <input type="text" name="firstName" size=25 maxlength=50>
<br>Last Name: <input type="text" name="lastName" size=25 maxlength=50>
<br>Email Address: <input type="text" name="emailAddress" size=50 maxlength=255>

<!-- the subscribe field is another CORE field that is optional.
If it is used and checked, than the newsletter subscription process
will be triggered for the passed emailAddress upon form submission -->
<br>Check here to subscribe to our newsletter: <input type="checkbox" name="subscribe" value="1">

<!--------------------->
<!-- CUSTOM FIELDS ------>
<!--------------------->
<!-- any number of custom fields can be created
each can have any name as long is not one of the above hidden or core field names
make sure to populate the otherFields field with the names of your custom fields
or they will not work -->
<br />How did you find out about us? <input type="text" name="source" size=50 maxlength=100 />
<br />What is your favorite color?
<select name="color">
<option>Red</option>
<option>Blue</option>
<option>Green</option>
</select>
<br />Do you like italian food? 
YES<input type="radio" name="likeItalian" value="1" /> 
NO<input type="radio" name="likeItalian" value="0" />

<!-- the following otherFields field is REQUIRED if you have ANY custom fields
enter a comman delim list of the field names -->
<input type="hidden" name="otherFields" value="source,color,likeItalian" />
<!--- DONE WITH CUSTOM FIELDS ---->

<!-- just your plain run of the mill submit button - nothing special -->
<br /><input type="submit" value="SUBMIT" />

<!-- close out the form -->
</form>