PDA

View Full Version : Dupliate fields


shaun.andrews
06-15-2009, 03:27 AM
I'm still fairly new with validation toolkit. I'm creating a registration page and I want to ensure that the email field and the username field are both unique. What is the easiest way to achieve this? Could it be somehow using the 'like' validate tool??

I have also purchased the registration solution pack as this gives me a tool to 'disect' but I'm still unable to work out how it is achieved in this pack!! I'm assuming it might have something to do with the 'checknum rows' line that is in the Server Validation!

Can you point me in the right direction please!! If it is something more complicated like with using the 'checknum rows' could you please be specific as i'm no programmer.

Thank you in advanced.

Ray Borduin
06-15-2009, 07:37 AM
The way you would do it is you would add a recordset filtered with the form elements you want to be unique. That way the recordset will either be empty (no repeats) or have a result (repeat).

then you can make sure those recordsets appear before the validation toolkit and use server validation to ensure the number of rows in that recordset is equal to 0.

The exact syntax depends on your server language.

shaun.andrews
06-16-2009, 03:24 AM
OK, I am using Php with Mysql so what would be the correct syntax for this??

Ray Borduin
06-16-2009, 08:05 AM
Use the DW Recordset in simple view. Choose your table and the ID column and use the filter settings provided to filter the recordset with the posted field value.

shaun.andrews
06-16-2009, 06:15 PM
Creating the recordset bit makes sense, I'm just unsure how to use validation toolkit to check the number of rows in that recordset is equal to 0.

Ray Borduin
06-17-2009, 06:48 AM
Look at the code for the recordset created. One line will set a variable equal to the number of rows returned.

Use that variable when you apply webassist server validations server behavior and validate using number validation minimum:0 maximum:0. If it returns anything but zero server validation will fail.

Server validation can validate any value, not just form elements.