A little background… I need to validate a new user by asking them to provide me with two pieces of information that should already exist in one row of our database. I have a form that has the two fields and I am using the Validate Data in Server Connect.
I am using the tutorial on how to validate if a record exist in a database. I followed the tutorial and it works great for one validation, but not for two. So if one value out of the two columns is a match, I get a status 200 but I need it to match both. Is this possible? Is there an easy way to do this?
I don’t think this is possible with the validator as it’s not possible to choose AND for the conditions (only OR). I think there may be an outstanding feature request for this but I can’t find it. It would a much more useful feature if it had this functionality. You could use a condition instead.
As Tom points out, the validator uses OR…and I agree, we need an AND option.
You can use a second validator step to almost get to the same place. It will work, however the 2nd validation will not execute if the first one fails, which prevents both fields from displaying the feedback to the user.
So I tried using two validations. If the first one validates and the second one does not, response 400. If the first one does not validate but the second one does, it returns a 200. Looks like if there are multiple, it goes off the last one. I will try and use conditional steps and see if that works.
Ah, I see there is a difference in that I am validating “Exist in Database” and you are validating “Does Not Exist in Database”. I tried it your way and it does validate each one like you show, but I need to make sure both values do exist and if not, return a message. I guess opposite of how you would usually do it.
What I’m trying to accomplish is being able to allow a user to sign up only if they are able to provide two fields of data in the database. Maybe there is a better way to accomplish this. I guess I could just validate one piece of data for now.
Ok, so I had an idea. I was thinking hey, this is just like logging someone in. It asks for credentials, and if they are met, it goes to the next page. So that’s what I tried to do…except now it looks like there is a bug that I can’t see the new security provider I just added. This is using Node.JS