close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Structure for inserting data through a validated 2 field login

Thread began 2/28/2010 11:46 am by roger391472 | Last modified 3/03/2010 7:07 pm by Eric Mittman | 686 views | 6 replies |

roger391472

Structure for inserting data through a validated 2 field login

Hi All,

I'm sorry to keep pestering you but I'm working on a new page now that I'm having trouble with, it's actually turning out much more complicated than I thought. Thus, the new thread because this is a new subject. I want to first see if I'm going about this the right way. First here's a description of what I'm trying to do.

I have a 2-field entry form, one is the email address and the other is the password. I've also got several hidden fields that I'm using to pass data from an existing database to the database on the insert behavior on this page. I'm doing it this way because this is a sweepstakes entry form so I don't want the visitor to have to fill out all the contact information fields every time. That information is already in a database that came from the sweeps registration form so it makes sense to use it and pass it through the hidden fields.

Here's the method that I've been trying:
RECORDSETS
One for pulling the data from the existing registration database named rs_sweeps_members_entered
One for storing the data from that table along with some new columns added named rs_sweeps_entries This is the one that has the insert server behavior on it.
One for validating that the e-mail address is in the registration database named rs_emailLookup_members
You'll see another one called rs_sweeps_catalogs but it's not a concern, it's being used for a repeating region on the page.

I've moved all of the recordsets to just below the header connections and all are testing fine.

I've added a session variable but this is one that I'm not sure that I need so please let me know. As long as the password validates as being found in the database then maybe that's all I need????

I've added the same email validation that I used on the track_sanction_registration page that you helped me with the past few days. That was the one using $totalRows_<?> with a numeric setting of -1 and 0 but I'm not sure if those settings should change for this application.

I've added the "show If" behavior on the e-mail field too but again I'm wondering about the settings on that. Currently I have it set to fail on $totalRows_rs_emailLookup_members but with this code it doesn't fail, it lets the insert go ahead whether the e-mail is validated or not. I have had this validation error displaying correctly at times in different coding attempts but it's not working with this current code.

When the data is inserted it just takes the first row of the sweeps_registration table in the rs_sweeps_members_entered recordset and inserts it into the new table on the rs_sweeps_entries recordset. It doesn't search for the row associated with the email address that was entered.

I'm sorry for he long post but I figured the more info the better. I've tried building this one element at a time but it seems that everything is so tied together that you about have to have all the behaviors there at once to really test it.

I've attached the code but please let me know if you need any more info.

Once again thanks in Advance, you guys have been lifesavers on this.

Roger

Attached Files
racing_sweeps_entry_CODE.zip
Sign in to reply to this post

Eric Mittman

I think that you should first get your insert working correctly, then you can move on to the validation of the email and other parts of this.

When it comes to the current insert you are just getting the first row of your recordset into the db. This is as expected if there is no filtering occurring on that rs. To make it so you can use this rs in the insert server behavior you will need to ensure that the rs is filtered by the user that you want to get the info for.

If you are already populating form with hidden fields that have the information to insert you should be able to use this info directly in your insert rather than get it from a rs.

How do you determine what user is being inserted? Whatever value you use to determine what user is the value that you will need to filter your recordset on to ensure you get the proper details.

Please post back with any questions that you have on this part or if you have any specific trouble with this filtering so that we can help you get going in the rite direction.

Sign in to reply to this post

roger391472

Hi Eric,

The filtering is what I've been working on so far this morning but I'm not clear yet on what filters I should be using. In other threads that I've been reading it says to filter on the form element, is that the field name?

I've tried a bunch of different filters on the emailLookup rs but I'm not sure I've had it right yet. Currently I have it set to: form variable--<the email field name>

I've also tried the $totalRows_emailLookup_members variable too but that didn't work.

The thought process that I've been working on is thinking that I have to validate the e-mail address and make sure it is in the database first so that I can select the correct row off of that. Is that not the case?

I'll make new changes based on your reply but if you want to see the code as I have it now let me know and I'll attach the new code. I have moved some stuff around since the last attachment and it did at least stop it from displaying the "show if" errors on page load and my "sort" behavior is working correctly. I'm pretty sure I have the code for the behaviors in the correct order now.

I guess the one thing I really need to be sure I'm doing correctly first is those filter settings.

Thanks again for all your help. Oh, and as far as Murphys law goes, yep, sure enough, my internet connection went out this morning. Geesh

Roger

Sign in to reply to this post

roger391472

Hi Eric,

I'm still not getting anywhere on this so I've attached the latest code to see if you could take a look at it. I think I have everything in the correct order but I'm just not sure.

1) I'm trying to use the value from $totalRows_emailLookup to validate the email address to be sure they've registered and the email address is in the database.
2) There's another database on the page that has all the registered users basic contact info in it and I'm trying to pass that through to another database through hidden fields. I'm trying to use $totalRows_emailLookup again to select the row within that contact database. I've got the rs filter set to filter the e-mail address column, server variable with the value of $totalRows_emailLookup. Will this work or do I need to use a session variable or something else?

I'm also using the $totalRows_emailLookup var for the validation and the "show If" validation so again I'm not sure if this is correct.

One line I keep wondering about is this one:
$WAFV_Errors .= WAValidateNM($totalRows_rs_emailLookup_members . "",-1,0,"",",.",false,14);

In other threads I've seen this has been set to true. I tried switching it to true but it didn't work but I still wonder about it.

Currently the page must be letting any e-mail address go through because I get the error "member_id can't be null" so it seems to me that it must be trying to insert but it hasn't found the row of data in $totalRows_emailLookup

More than ever I really appreciate your help.
Thanks,

Roger

Attached Files
sweeps_entry_code-3-1-10.zip
Sign in to reply to this post

Eric Mittman

This is how I see things, you have this page for users to register for the sweepstakes. To register they must already be registered in your sweeps_registration table. When they fill in the form you will have a recordset for the user that is filtered on the entered email address. It would be a good idea to also filter this on the password entered to ensure that it is that user who is signing up for the sweepstakes.

I think you could do this in the following order.

Have the form post to itself (done)

Have a recordset toward the top of the page that is filtered on the user's email address and password. These are the form fields for the username and password.

Next is the validation, you will need to validate the total rows from this recordset to ensure that there was a match. (done)

Finally after all of this you can have the insert to insert the user into the sweeps_entries_tracking table. For this insert you will be inserting the same user information that you already have in your sweeps_registration table. Since you have the rs that is filtering this table based on the email and password you can use the bindings from this rs directly in the insert.

That is all that you need to accomplish this, in the end you will have a form that a registered user can get to and enter their email address and password. The information will be posted back to this page and filter a recordset. It is this recordset that will be used for the validation to ensure that the user is registered. You will also use this same recordset in your insert server behavior.

You should start this by editing your existing rs to be filtered on at least the form field for the email, and the password as well if that is an option. Once you have got that part worked out the validations should already be working and you can move onto the insert. Please post back with any questions that you have and we can help you get things worked out.

Sign in to reply to this post

roger391472

Hi Eric,

That's correct, I wish I would have caught you before you had to do the work on it again, but I just got off the phone with Les Crowley a little while ago and he got it going for me. I was just running too far behind so I had to hire it done.

I appreciate the help though. I've got more to be done so I'm sure you'll be hearing from me again.

Thanks,

Roger

Sign in to reply to this post

Eric Mittman

Ok, let us know if you have any other questions.

Sign in to reply to this post

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...