Advertisement
Guest User

Untitled

a guest
Jun 7th, 2011
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cfset errors = arrayNew(1)>
  2. <cfset showform = true>
  3. <cfparam name="form.name" default="">
  4.  
  5. <cfif structKeyExists(form, "submit")>
  6.   <cfif not len(trim(form.name))>
  7.     <cfset arrayAppend(errors, "Enter a name")>
  8.   </cfif>
  9.  
  10.   <cfif not arrayLen(errors)>
  11.     <!--- store result to db, or email it, whatever --->
  12.     <cfset showform = false>
  13.   </cfif>
  14. </cfif>
  15.  
  16. <cfif showform>
  17.   <cfif arrayLen(errors)>
  18.     <p>
  19.     <b>Please fix these errors:</b><br/>
  20.     <cfloop index="e" array="#errors#">
  21.       <cfoutput>#e#<br></cfoutput>
  22.     </cfloop>
  23.     </p>
  24.   </cfif>
  25.  <form method="post">
  26.   <cfoutput>
  27.   enter your name : <input type="text" name="name" value="#form.name#"><br/>
  28.   </cfoutput>
  29.   <input type="submit" name="submit">
  30.  </form>
  31.  
  32. <cfelse>
  33.  
  34.   Thanks!    
  35.  
  36. </cfif>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement