That does make sense and seems to be just what I was looking for.
Thanks again Jeff.

Respectfully,
Dan Nall

-----Original Message-----
From: Jeff Fleitz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 22, 2005 4:15 PM
To: [email protected]
Subject: Re: [plum] Table relationship (or putting stuff where it
belongs)

If you are going to use the session scope in your app (I recommend
this), just do what I described in the second 
paragraph below. Create a session structure in the security.cfm as I
described (review the code below again). This will 
be available until the student logs out or the session expires



 >      <!--- Create a session structure --->
 >      <cfset Session.student = StructNew()>
 >      <cfscript>
 >              Session.student.userID = userQuery.UserID;
 >      </cfscript>


Then in the action page of the add form you are talking about, you set
the insert to handle the session variable:

<cf_PassColumnToAction column="UserID" type="integer"
value="#Session.student.userID#" valueIfEmpty="NULL">


Make sense?

Jeff


Nall Daniel A GS-09 336 TRSS/TSUD wrote:
> Jeff, 
> I have a separate table (Students).   This is the parent table for
other
> tables that the student may or may not have to fill out.  After the
> student logs in they have to fill out a registration form (Students
> table).  I want to ensure that their userID gets inserted into the
> students table and that every form they may (or may not) fill in from
> there gets their studentID as foreign key.  Things are looking a
little
> muddy here.  
> 
> Respectfully,
> Dan Nall
> 
> -----Original Message-----
> From: Jeff Fleitz [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 22, 2005 3:19 PM
> To: [email protected]
> Subject: Re: [plum] Table relationship (or putting stuff where it
> belongs)
> 
> Hi Dan,
> 
> Do you have to have a separate table, or can you make the PlumUser and
> Student tables synonymous, and just extend the 
> PlumUser table to handle your extra requirements? Then you always know
> the user that logged in is the student.  You can 
> still deal with several other forms, by having those extra fields
accept
> nulls during registration and then fill them 
> out later with your other forms. Smoke and mirrors ;)
> 
> Another option is to create a session user or student structure at
login
> and store the userid to the 
> session.student.studentid, for instance.  I have done this by
modifying
> the security.cfc to initialize the session 
> structure (user in this case) if the userQuery returns a row (valid
> user).  I use this structure to store all kinds of 
> info, like how many rows they want to display in a list, as opposed to
> having it hardcoded.
> 
> 
> See the code at about line 56.
> 
> 
> 
> <cfif userQuery.RecordCount NEQ 1>
>       <cfif Application.persistentScope EQ "Session">
>               <cfset Session.email = Arguments.Email>
>               <cfset Session.password = Arguments.Password>
>       <cfelse>
>               <cfset Client.email = Arguments.Email>
>               <cfset Client.password = Arguments.Password>
>       </cfif>
>       <cfif Application.allowUsersToCreateTheirOwnProfiles>
>               <cfthrow type="Authenticate.UserNotFound"
>                       message="You are not in our system."
>                       errorcode="66010">
>       <cfelse>
>               <cfthrow
> type="Authenticate.UserNotAllowedToCreateProfile"
>                       message="That email address is not in our
> system. Please try a different address."
>                       errorcode="66020">
>       </cfif>
> <cfelse>
>       <!--- JAF: 10/17/04; add session variables to track user --->
>       <cfset Session.user = StructNew()>
>       <cfscript>
>               Session.user.userID = userQuery.UserID;
>               Session.user.accessLevel = userQuery.AccessLevel;
>               Session.user.lastLogin = userQuery.LastLogin;
>               Session.user.timesLoggedIn = userQuery.TimesLoggedIn +1;
>               Session.user.rowsPerPage = userQuery.RowsPerPage;
>               Session.user.displayIcons = userQuery.DisplayIcons;
>       </cfscript>
>       <!--- JAF: 10/17/04; update login statistics --->
> 
>       <cfinvoke
>               component="#Application.Security#"
>               method="UpdateUserStats"
>               userID=#userQuery.userid#
>               timesloggedin = #Session.user.timesLoggedIn#>
> </cfif>
> 
> 
> 
> HTH,
> 
> Jeff
> 
> 
> 
> Nall Daniel A GS-09 336 TRSS/TSUD wrote:
> 
>> My site has several forms for users to fill out. The main table 
>>(Students) has studentID as its primary key and UserID (PlumUser
> 
> table) 
> 
>>as its foreign key.  How do I ensure that the Students form gets the 
>>correct UserID inserted and the following forms (which have studentID
> 
> as 
> 
>>their foreign keys) get the correct studentID inserted?  Users 
>>(students) must be logged in to fill out these forms.
>>
>> 
>>
>>Respectfully,
>>
>>Dan Nall
>>
> 
> 
> **********************************************************************
> You can subscribe to and unsubscribe from lists, and you can change
> your subscriptions between normal and digest modes here:
> 
> http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
> **********************************************************************
> 
> **********************************************************************
> You can subscribe to and unsubscribe from lists, and you can change
> your subscriptions between normal and digest modes here:
> 
> http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
> **********************************************************************
> 
> 

**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:

http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************

**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:

http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************

Reply via email to