close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Check for duplicate records

Thread began 8/14/2011 11:34 pm by davegw | Last modified 7/25/2012 7:58 am by jon211112 | 3366 views | 7 replies |

davegw

Check for duplicate records

How can I use Form Toolkit to check for duplicate records in a unique field? I could not find it in the list of server validations. It must be checked when inserting a new record or updating an existing record. I'm using DW CS5.

Sign in to reply to this post

Jason ByrnesWebAssist

see this thread for details:
showthread.php?t=19462

Sign in to reply to this post

davegw

Thanks Jason, works like a charm! I had to move the validation code block between the recordset & insert form behavior as suggested in the thread.

Sign in to reply to this post

davegw

This detects duplicates when inserting a record, but when an existing record is updated it complains on my error page that the field entry already exists, when the unique field has not been changed. A condition probably needs to be applied to the WA Server Validation entry that checks that $totalRows_recordsetname numeric range is from -1 to 0.

in my case:

$WAFV_Errors .= WAValidateNM($totalRows_rsChkRefNo . "",-1,0,0,",.",true,4);

Code blocks are in this order:

Recordsets
WA SV
Update Form

Sign in to reply to this post

Jason ByrnesWebAssist

when the user logs in a session with their id is stored, if the ID in the recordset is the same you could bypass the check.

this example assumes that the session created by the login is "ID" and the name of the ID column in your database is "ID"

$WAFV_Errors .= WAValidateNM((($row_rsChkRefNo['ID'] == $_SESSION['ID'])?0:$totalRows_rsChkRefNo) . "",-1,0,0,",.",true,4);

Sign in to reply to this post

jon211112

Hi Jason

I have the same problem but am using the latest Data Bridge so I think the syntax has changed?

I have a form which allows the member to update their details. Their email address is used to log them in (with password of course) and the form allows them to change all their details including their email address. I need to check that the email entered is not already in the database, but if they leave it as it is then it should allow it.

At the moment it's checking the email is unique and giving the error because it's found it in the database. But the record it found is the one for the person logged in.

I need to be able to make the validation work only if the field has changed. If it matches the field in the record then it should either not update it or update it in the normal way but without triggering the error.

I hope this is straight forward.

Many thanks

Jon

Sign in to reply to this post

Jason ByrnesWebAssist

In data bridge, there is a new validation type for Unique Database value.

In the unique database value validation, you select the column to be unique and the form element used for entering it.

It also has a section to select the ID column, the security Assist authentication stores the userID in a session variable at login, in the validation, bind the ID value to the security assist ID session variable, this will allow the user to reuse his email address.

Sign in to reply to this post

jon211112

Perfect, thanks Jason.

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