I was wondering if this is good
Well, are you just looking to prevent the normal user from messing up during registration? I think it would be fine for that.
I'll see if I can point out flaws in your validation...
- First, you check to see if
length
is 0. If it is, you warn them. Cool. But right after, you check to see if it's greater than 0. This is redundant? It would have to be longer than 0 characters to pass the first conditional! - Now you check
length < 7
. But what if my email is[email protected]
? Eeek! But I was lucky and set up my domain www.a.ca with email support and registered with my first initial! - Why can't the username be longer than 30 characters? Is your database not capable of such long strings? If it truly just cannot handle those awfully long names, fine. If it can, I'd suggest you support long names! Besides, I'd hate to find a new username if I've always used my most favorite 32 characters username!
- Why can't my password be longer than 50 characters either? I might be one of those users who has funky passwords users who has funky passwords that are always has 9 words in their passwords.
- What exactly is
passwordCombination()
? If I'm one of those funky users I mentioned in point 4, I'd be upset with this rule. - Use
<input type="email" />
to validate emails on the client-side, notemailValidate()
. Then check it again on the server with something such as PHP'sfilter_var()
. ":("
should really be"):"
to be consistant with eye placement in"D:"
.
There's some critique on your validation. So maybe it would be best to find an established validation library and make slight alterations to suit you! Google has some validation standards, and W3C also has some tips and tricks up their sleeve!
But always remember:
Servers should not rely on client-side validation. Client-side validation can be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user agents
Now I'm not JavaScript maniac, but I might be able to help a little!
- I believe you could generalize
$(this).find(".input-field")
into something such as$(this).find("input[type=text], input[type=password]")
. This way you don't rely on having that class. - You just check if
error_field
is empty, so why not make it simpler and turn it into a counter. Each error increments it. In the end, if it's value is equal to 0, it's all good!
I was wondering if this is good
Well, are you just looking to prevent the normal user from messing up during registration? I think it would be fine for that.
I'll see if I can point out flaws in your validation...
- First, you check to see if
length
is 0. If it is, you warn them. Cool. But right after, you check to see if it's greater than 0. This is redundant? It would have to be longer than 0 characters to pass the first conditional! - Now you check
length < 7
. But what if my email is[email protected]
? Eeek! But I was lucky and set up my domain www.a.ca with email support and registered with my first initial! - Why can't the username be longer than 30 characters? Is your database not capable of such long strings? If it truly just cannot handle those awfully long names, fine. If it can, I'd suggest you support long names! Besides, I'd hate to find a new username if I've always used my most favorite 32 characters username!
- Why can't my password be longer than 50 characters either? I might be one of those users who has funky passwords that are always has 9 words in their passwords.
- What exactly is
passwordCombination()
? If I'm one of those funky users I mentioned in point 4, I'd be upset with this rule. - Use
<input type="email" />
to validate emails on the client-side, notemailValidate()
. Then check it again on the server with something such as PHP'sfilter_var()
. ":("
should really be"):"
to be consistant with eye placement in"D:"
.
There's some critique on your validation. So maybe it would be best to find an established validation library and make slight alterations to suit you! Google has some validation standards, and W3C also has some tips and tricks up their sleeve!
But always remember:
Servers should not rely on client-side validation. Client-side validation can be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user agents
Now I'm not JavaScript maniac, but I might be able to help a little!
- I believe you could generalize
$(this).find(".input-field")
into something such as$(this).find("input[type=text], input[type=password]")
. This way you don't rely on having that class. - You just check if
error_field
is empty, so why not make it simpler and turn it into a counter. Each error increments it. In the end, if it's value is equal to 0, it's all good!
I was wondering if this is good
Well, are you just looking to prevent the normal user from messing up during registration? I think it would be fine for that.
I'll see if I can point out flaws in your validation...
- First, you check to see if
length
is 0. If it is, you warn them. Cool. But right after, you check to see if it's greater than 0. This is redundant? It would have to be longer than 0 characters to pass the first conditional! - Now you check
length < 7
. But what if my email is[email protected]
? Eeek! But I was lucky and set up my domain www.a.ca with email support and registered with my first initial! - Why can't the username be longer than 30 characters? Is your database not capable of such long strings? If it truly just cannot handle those awfully long names, fine. If it can, I'd suggest you support long names! Besides, I'd hate to find a new username if I've always used my most favorite 32 characters username!
- Why can't my password be longer than 50 characters either? I might be one of those users who has funky passwords that are always has 9 words in their passwords.
- What exactly is
passwordCombination()
? If I'm one of those funky users I mentioned in point 4, I'd be upset with this rule. - Use
<input type="email" />
to validate emails on the client-side, notemailValidate()
. Then check it again on the server with something such as PHP'sfilter_var()
. ":("
should really be"):"
to be consistant with eye placement in"D:"
.
There's some critique on your validation. So maybe it would be best to find an established validation library and make slight alterations to suit you! Google has some validation standards, and W3C also has some tips and tricks up their sleeve!
But always remember:
Servers should not rely on client-side validation. Client-side validation can be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user agents
Now I'm not JavaScript maniac, but I might be able to help a little!
- I believe you could generalize
$(this).find(".input-field")
into something such as$(this).find("input[type=text], input[type=password]")
. This way you don't rely on having that class. - You just check if
error_field
is empty, so why not make it simpler and turn it into a counter. Each error increments it. In the end, if it's value is equal to 0, it's all good!
I was wondering if this is good
Well, are you just looking to prevent the normal user from messing up during registration? I think it would be fine for that.
I'll see if I can point out flaws in your validation...
- First, you check to see if
length
is 0. If it is, you warn them. Cool. But right after, you check to see if it's greater than 0. This is redundant? It would have to be longer than 0 characters to pass the first conditional! - Now you check
length < 7
. But what if my email is[email protected]
? Eeek! But I was lucky and set up my domain www.a.ca with email support and registered with my first initial! - Why can't the username be longer than 30 characters? Is your database not capable of such long strings? If it truly just cannot handle those awfully long names, fine. If it can, I'd suggest you support long names! Besides, I'd hate to find a new username if I've always used my most favorite 32 characters username!
- Why can't my password be longer than 50 characters either? I might be one of those users who has funky passwords that are always has 9 words in their passwords.
- What exactly is
passwordCombination()
? If I'm one of those funky users I mentioned in point 4, I'd be upset with this rule. - Use
<input type="email" />
to validate emails on the client-side, notemailValidate()
. Then check it again on the server with something such as PHP'sfilter_var()
. ":("
should really be"):"
to be consistant with eye placement in"D:"
.
There's some critique on your validation. So maybe it would be best to find an established validation library and make slight alterations to suit you! Google has some validation standards, and W3C also has some tips and tricks up their sleeve!
But always remember:
Servers should not rely on client-side validation. Client-side validation can be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user agents
Now I'm not JavaScript maniac, but I might be able to help a little!
- I believe you could generalize
$(this).find(".input-field")
into something such as$(this).find("input[type=text], input[type=password]")
. This way you don't rely on having that class. - You just check if
error_field
is empty, so why not make it simpler and turn it into a counter. Each error increments it. In the end, if it's value is equal to 0, it's all good!