close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Form Validation - if value already exists

Thread began 1/10/2011 10:44 pm by SaladoGuy | Last modified 1/11/2011 4:40 pm by Jason Byrnes | 990 views | 7 replies |

SaladoGuyBeta Tester

Form Validation - if value already exists

I have the SuperSuite, and I'm wanting to validate a particular form field to make sure that the entered value doesn't already exist in the database.
I know that I can go to the Server Behaviors panel choose WA Validation Toolkit > Server Validation, but it doesn't seem like it has the option I'm looking for.
Does that really not exist, or am I just blind?

I just realized that I put this thread in the eCart forum... sorry about that, can somebody move it for me?

Sign in to reply to this post

Jason ByrnesWebAssist

create a recordset to lookup the value that was entered in the database.


Add server validation. Set the server variable to "$totalRows_RecordsetName" where RecordsetName is the name of the recordset.

Use number validation. set the minimum to -1 and the maximum to 0.

Sign in to reply to this post

SaladoGuyBeta Tester

I tried what you explained, but it doesn't really work. I think it is because the "value" I want to validate isn't a number (I should have made that clear before). Will this work with varchar, or only numbers? If it only works with numbers, how can I do this with alphabet characters?

Sign in to reply to this post

Jason ByrnesWebAssist

it doesn't matter if the value is a number or not.


the idea is that you create a recordset to lookup the value that is entered, the recordset returns a variable named $totalRows_RecordsetName, this contains the number of rows in the recordset.


the numeric validation is making sure that the $totalRows_RecordsetName is equal to 0, which would mean the recordset is empty, the recordset would be empty if the entered value is not found in the database.

send a copy of your page so i can look at the code.

Sign in to reply to this post

SaladoGuyBeta Tester

Here's my file.

Attached Files
edit.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

code order is the problem


the code order goes like this on your page:

Server Validation
Insert record
Recordsets


the code needs to be rearranged so the code order is:
recordsets
Server Validation
Insert record

Sign in to reply to this post

SaladoGuyBeta Tester

NICE! Works great now.
Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

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