[thelist] coding required form fields to work with Javascript turned off

Sharon F. Malone sfmalo at 24caratdesign.com
Wed Feb 27 10:31:01 CST 2002


On Saturday, February 23, 2002 5:44 AM, Matt Garrett wrote:
(see below my comments)

Matthew, being the rank novice I am re Cold Fusion, I think I've gone as far as I can go in making any more changes to the .htm and corresponding .cfm pages as I have. DJC has been giving me a lot of help offline, but perhaps it's time for me to present it to theList.

I have the two pages in question on the Evolt server for CF testing. and, I already have the last two fields set up (and working right) in the processing .cfm page to generate error messages with JS turned off. That being the case, if I could, I'd like to leave the form .htm page as is and not make it into an Include. I'm just bogging down in exactly how to proceed with the .cfm processing file coding. This is what I have now in the .cfm processing file:

<cfparam name="demo" default="Not selected. You may submit this form again.">
<cfif IsDefined("form.demo")>
 <cfif form.demo is "Magenta">
 <cfset filename = "MagentaDemo.exe">
 <cfset size = "1.6Mb">
<cfelseif form.demo is "XwScan">
 <cfset filename = "XwscanDemo.exe">
 <cfset size = "1.5Mb">
<cfelse>
  <cfset filename = "0">
  </cfif>
<cfelse>You need to select which demo software you want. Please press the Back arrow.<br>(If you just want to download the demo manual, you'll still need to select either Magenta <br>or XwScan. However, you won't need to download either. Please mention that<br>you are just downloading the manual in the Comments. Thank you.)
</cfif>

<cfparam name="manual" default="Not selected. You may submit this form again.">

<cfif IsDefined("form.manual")>
 <cfif form.manual is "Yes">
 <cfset filename1 = "primersurvey3.zip">
 <cfset size1 = "1.49Mb">
<cfelseif form.manual is "No">
  <cfset filename1 = "">
</cfif>
<cfelse>You need to select (Y)es or (N)o! Please press the Back arrow.
</cfif>

Then should I add a parameter for each of the 8 other fields in question (that have to do with first name, last name, co name, email address etc.), as

 <cfparam name="fname" default="">

<cfif IsDefined("form.fname")>
<cfset ????????
<cfelse>You need to include this information. Please press the Back arrow.
</cfif>

This is where I go south!!!!!! Would appreciate your or anyone else's input.

Sharon

> First:
> Make your form a re-usable include which is used for adding AND editing the
> info. Set default values to "", then output the values in the form. If the
> form
>
> Example
> <cfparam name="field1data" default="">
> <cfparam name="field2data" default="">
> <cfoutput>
> <form>
>     <!--- this part is triggered by stuff on
>         the processing page (see below) --->
>     <cfif isdefined('missed_list')>
>         <cfif findnocase(missedlist, 'field1')>
>             Hey you forgot this field
>         </cfif>
>     <input type="text" name="field1" value="#field1data#">
>     <input type="text" name="field2" value="#field2data#">
> </form>
> </cfoutput>
>
> In the processing page test the form variables and re-include the form if
> some are missing/incomplete:
>
> <cfset requiredfields="field1, field2, field3">
> <cfset missed_list="">
> <cfloop list="requiredfields" index="current_field">
>     <cfif current_field IS ''>
>         <cfset missed_list=listappend(missed_list, current_field)>
>     </cfif>
> </cfloop>
> <cfinclude template="form.cfm">
>
> ok, i'm late for a meeting.... hope that points you in the right direction
> matt
---------------------------------------------------------------------------
Sharon F. Malone
"web design and Internet writing services"
http://www.24caratdesign.com
sfmalo at 24caratdesign.com





More information about the thelist mailing list