Kevin Jordan | 6 Mar 19:08

[FormBuilder] How to validate input not in list?

I need to be able to validate that the information the user puts in a field on my form is NOT in a long list that I have in a file.
The reason behind this being I never want the same value used twice.  For example, once a username is used, I don't want to allow someone to request it again.
 
What is the best way to do this?
 
 
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
Nate Wiger | 6 Mar 19:21

Re: [FormBuilder] How to validate input not in list?

On 3/6/07, Kevin Jordan <kjordan3 <at> gmail.com> wrote:
> I need to be able to validate that the information the user puts in a field
> on my form is NOT in a long list that I have in a file.
> The reason behind this being I never want the same value used twice.  For
> example, once a username is used, I don't want to allow someone to request
> it again.
>
> What is the best way to do this?

1) Add a unique DB constraint so bad data can't possibly get in

2) Write a \&check_username_is_unique callback function, and pass it
to validate for 'username'

-Nate
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Kevin Jordan | 6 Mar 19:40

Re: [FormBuilder] How to validate input not in list?

Forgive my ignorance, but I need  a little clarification on your response.
 
1) I'm not familiar with this at all.  Is the unique DB constraint usage documented on the website?
2) So I would have something like this?
 
    user_id   => \&check_username_is_unique,
 
     then just make that sub do whatever checking I want it to do.  But what would it need to return? 1 or 0?

 
On 3/6/07, Nate Wiger <nwiger <at> gmail.com> wrote:
On 3/6/07, Kevin Jordan <kjordan3 <at> gmail.com> wrote:
> I need to be able to validate that the information the user puts in a field
> on my form is NOT in a long list that I have in a file.
> The reason behind this being I never want the same value used twice.  For
> example, once a username is used, I don't want to allow someone to request
> it again.
>
> What is the best way to do this?

1) Add a unique DB constraint so bad data can't possibly get in

2) Write a \&check_username_is_unique callback function, and pass it
to validate for 'username'

-Nate

_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Gmane