submitted values. 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), and then read it out of the session scope into the form after
the CFLOCATION.
I'd recommend the middle option (including the form), becuase it
allows you to separate processing from the form itself, but doen't
make you deal with the extra persistant storage.
cheers,
barneyb
On Tue, 17 Aug 2004 21:59:38 -0400, Roberto Perez <[EMAIL PROTECTED]> wrote:
> At 06:36 AM 8/17/04, Barney Boisvert wrote:
> >The simplest approach is to use a CFPARAM for every form field at the
> >top of your form, and then use the VALUE attribute of the INPUT tag to
> >load the value.
>
> Hi all,
>
> I still can't get the desired results, so I'm posting some code so that
> someone can tell me what I'm missing. Basically I could have a "form.cfm"
> and an "action.cfm" page, or I could process both form and actions on the
> same page. I'm using the first option (2 separate pages), following one of
> the examples posted before:
>
> - - - - Form page (registrationForm.cfm) - - - - - -
>
> <cfparam name="form.UserFirstName" default="">
> <cfparam name="form.UserLastName" default="">
>
> <cfoutput>
> <form action="" method="POST"
> name="registration_form" id="registration_form">
> <input name="UserFirstName" type="text" value="#form.UserFirstName#"
> size="15" maxlength="25">
> <input type="text" name="UserLastName" value="#form.UserLastName#"
> size="15" maxlength="35">
> <input type="text" name="UserID" maxlength="20" size="15">
> <input type="submit" name="register" value="Submit">
> </form>
> </cfoutput>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> - - - - Action page (registrationAction.cfm) - - - -
>
> <cfif NOT isDefined("form.register")>
> <cfset back2registration="registrationForm.cfm?warning=" &
> URLEncodedFormat("Invalid information entered. Please complete this
> registration form")>
> <cflocation url=""> > </cfif>
>
> <cfif IsDefined("FORM.register")>
> <cftransaction>
> <cfquery name="checkUser" datasource="dicUsers_dsn">
> SELECT user_tb.UserID FROM user_tb WHERE user_tb.UserID='#FORM.UserID#'
> </cfquery>
>
> <cfif checkUser.RecordCount GTE 1>
> <cfset back2registration ="registrationForm.cfm?message=" &
> URLEncodedFormat("Username already exists. Please choose a different one")>
> <cflocation url=''>
> <cfelse>
> (create the username here before someone else takes it. Code not
> included)
> </cfif>
> </cftransaction>
> </cfif>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> As it is now, when the visitor is sent back because the username already
> exists, the First Name and Last Name fields in the form are not
> self-populated with the previously entered information, and the visitor has
> to re-enter all of it (the real form has much more information to be
> re-entered).
>
> So, what am I missing here?
>
> Thanks in advance,
>
> Roberto
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

