> To repopulate the form, you'll either have to
>submit the form to itself, include the form in the action page (with
>CFINCLUDE), or set the form data to some persistant scope (session or
>client)
I liked the "include" option also. It was tricky to implement, though,
since I couldn't have a CFInclude within a CFTransaction tag, so I had to
reverse my logic to have the include outside that tag. So I adapted the
pseudocode sent by Patricia Lee and others and got it to work with this
structure:
Form page: regular form structure with a couple of CFIf's to capture error
messages.
Action page:
<cfif NOT isDefined("form.register")>
<cfset back22registration="registrationForm.cfm?warning=" &
URLEncodedFormat("Invalid information entered. Please complete this
registration form")>
<cflocation url=""> </cfif>
<cfif IsDefined("FORM.register")>
<cfif form.UserID is "">
<cfset errorWarning = "Please correct the problems described in red
below">
<cfset userIsEmpty = "The username field was empty. Please complete
it.">
<cfinclude template="registrationForm.cfm">
<cfelse>
<cftransaction>
<cfquery name="checkUser" datasource="dicUsers_dsn">
SELECT user_tb.UserID FROM user_tb WHERE user_tb.UserID='#FORM.UserID#'
</cfquery>
<cfif checkUser.RecordCount is 0>
<cfset variables.mustShowRegForm = "no">
<cfquery datasource="dicUsers_dsn">
(insert new user here)
</cfquery>
</cfif>
</cftransaction>
<cfif variables.mustShowRegForm is "no">
<cflocation url=""> <cfelse>
<cfset errorWarning = "Please correct the problems described
in red below">
<cfset userExists = "Username already exists. Please choose
a different one.">
<cfinclude template="registrationForm.cfm">
</cfif>
</cfif>
</cfif>
Let me know if you see any errors/contradictions/unnecessary redunduncies.
Thanks,
Roberto Perez
[EMAIL PROTECTED]
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

