This topic is locked

Auto-Population

4/8/2005 12:31:22 PM
ASPRunnerPro General questions
S
Siqstring author

I did a search on auto-population in the forums and there were three responses as to how to do this.
Can someone please describe in better detail than just "remove it from the ADD page" ?
Thanks

Matthew

Sergey Kornilov admin 4/11/2005

Mathhew,
this means you have to proceed to the Formatting tab in ASPRunnerPro and uncheck "Add page" checkbox for this field.

501155 4/13/2005

thanks I have tried this many times it only seems to remove the fields from the edit page and never populates the fields in the table ?

Sergey Kornilov admin 4/16/2005

Matthew,
I'm talking about removing fields from the ADD page. This do not apply to the EDIT page.

ngomong 7/1/2005

I'm a bit confused here, too...
What I'd like to do is this:
A user logs in and adds a record. When they do so, two fields should auto-populate: Name and Location. This data sits in a Logins table, which holds the userID, Name, and Location.
So, if UserA logs in and adds a record to the main table, the name and location fields will get autopopulated with NameA and LocationA.
If UserB logs in and adds a record to the main table, the name and location fields will get autopopulated with NameB and LocationB.
If I uncheck the checkbox for these fields on the Add Page, when the record is added, these fields are blank for the new record.
Can you explain how to accomplish the auto-population?
Thanks!

ngomong 7/19/2005

Well, I figured it out...
In the template for the login page, I found this bit of code:

   If Not rs.EOF Then

 while not rs.eof

 if request("username")=CStr(rs(cUserNameField)) and

            request("password")=CStr(rs(cPasswordField)) then

         Session("UserID") = Request("username")


... and I simply added a couple of lines. (One for each field I needed... RMLname and RMLlocation.)

   If Not rs.EOF Then

 while not rs.eof

 if request("username")=CStr(rs(cUserNameField)) and

            request("password")=CStr(rs(cPasswordField)) then

         Session("UserID") = Request("username")

         Session("RMLname") = CStr(rs("RMLname"))

    Session("RMLlocation") = CStr(rs("RMLlocation"))


Basically, I'm just creating some new session variables, using data from the main SQL query.
Then, for the fields I wanted auto-populated, I gave them hidden on the add and edit pages, and gave them a default value of Session("RMLname") and Session("RMLlocation").
Tada.
Since the code was changed in the template, then every time you rebuild the app, these changes will remain. Very cool.
Hope this helps someone out in the future...
clay.