close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

insert and update based on user ...?

Thread began 12/27/2012 9:23 am by jamie.ghio444407 | Last modified 12/27/2012 2:49 pm by Ray Borduin | 1066 views | 5 replies |

jamie.ghio444407

insert and update based on user ...?

Im building a system for an employment application. The user/applicant will register for a login. (I am using the create double opt in registration tutorial to build the login portion)

1. I created a table to hold references. The columns I used are id(PK), user_id, name, phone, relation, how_long

2. I used DataAssist to create insert and update pages.
a. On the insert page setup I chose to leave out the id as it should be ok to auto increment on its own. I changed the user_id to a hidden field. The other fields I required but not relevant as my question pertains to the user_id and id.
b. On the update page I used both id and user_id to hidden (both fields are included on the page) and the other fields set same as the insert page.

3. The pages are created. Now I need to make sure the pages are looking for the correct values to attach the records to the correct user. I have stopped here to ask for guidance. I think I need to do the following but not sure if I am correct and dont want to have to start over.

a. On the insert page - Click the hidden field and replace the value with the binding "Sesson - SecurityAssist_UserID" - Im thinking this will set that value when the page loads to the sesson value held for the user. Am I correct?
b. On the update page I'd handle my user_id hiddden field the same way as above, but for the id field of the record that was inserted, wouldn't I create a new recordset called getRefID looking for all records in the reference table and filter the data WHERE user_id = "sesson UserID" AND id = url parameter id passed from the previous page (the users view page) and then set the value of my hidden id field to the result of the recordset id column.

This all seems right in my head but since dataassist creates code for me I dont want to remove any before i am sure that i am removing the correct stuff.

Would you do it this way or take another route?

Sign in to reply to this post

Ray BorduinWebAssist

You should not include your id as a hidden field. Autonumber fields should be left off the pages entirely when creating the insert and update pages.

The wizard will automatically add another hidden field to hold the ID and update the correct record. You are over-thinking it and it will actually cause issues. Just leave off the autonumber field and everything will work automatically. The wizard will automatically do what you are trying to add manually and by doing what you are doing it is more likely to cause issues.

Sign in to reply to this post
Did this help? Tips are appreciated...

jamie.ghio444407

Okay, but what about the user_id field/column that I created within the references table. Do I have to do anything to tie the user's id held in the sesson to get it to insert that id into the references table as user_id (my column name)? I am using multiple tables with 1 to many relation.

Sign in to reply to this post

Ray BorduinWebAssist

On the insert page you can open the main table insert server behavior and see what the Save As field is set to. It will store the newly inserted ID as a session variable with that name. Then you can use that when inserting to the joined tables after.

On the update page, open the main table update server behavior and see what the Update key value field is set to. You can copy and paste that value for the ID in the joined tables.

Sign in to reply to this post
Did this help? Tips are appreciated...

jamie.ghio444407

Okay, I deleted the 2 pages I previously created (Update and Insert) to start fresh.

When I create the new pages using DataAssist, I want to create Insert and update. So this time I did not include the id for the table on either page. But since I want to user the userID I do need to include that field, right? and it doesn't need to be a text box or even display, so I make it hidden right?

Then do as you said in the previous message, but to clarify, use the session value for the value of the hidden field (user_id)? or am I over thinking this again?

Sign in to reply to this post

Ray BorduinWebAssist

No... don't include that field at all on the insert or update pages.

Since you set it as the id field it will be included where it needs to be automatically.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...