Worth validating with JS as well as php?

This is a discussion on "Worth validating with JS as well as php?" within the PHP Forum section. This forum, and the thread "Worth validating with JS as well as php? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 5th, 2008, 10:13
Junior Member
Join Date: Oct 2007
Location: UK
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Worth validating with JS as well as php?

If you're validating a form using a server side language, is there any point validating it client side as well?

I know that client side validation is faster, but I wouldn't of thought it would be much faster and also means you have to type some extra code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 5th, 2008, 10:41
Reputable Member
Join Date: Feb 2006
Location: London
Age: 26
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Re: Worth validating with JS as well as php?

Validating with javascript first would save some server resource.

It might save the user some frustration if they have a slow connection. Reloading a page only to see you have entered fields incorrectly can be pretty annoying!

I'd do both if you have time, otherwise, stick with PHP.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 6th, 2008, 14:57
Reputable Member
Join Date: Jan 2008
Location: Pasig
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Worth validating with JS as well as php?

It is a good practice to include PHP when validating because JS can be disabled in the browser so, your JS validation is useless...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 6th, 2008, 15:20
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Worth validating with JS as well as php?

@ Sekuchi, djeyewater was asking if it was necessary validating with Javascript on top of PHP validation.

@djeyewater - I agree with jimz. If you've got the time, it's a helpful feature that'll save a slice of system resource.

If you are going to stick to just PHP, make sure that data is returned to the form fields. People get easily frustrated if they click submit, only to be presented with an error and all their inputs lost!
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 6th, 2008, 15:28
Reputable Member
Join Date: Jan 2008
Location: Pasig
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Worth validating with JS as well as php?

Quote:
Originally Posted by aso186 View Post
@ Sekuchi, djeyewater was asking if it was necessary validating with Javascript on top of PHP validation.
Well, I just made an opinion that using PHP is a good practice for validation. That's all...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Mar 7th, 2008, 12:44
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Worth validating with JS as well as php?

Yes, this is a very user-friendly feature. It saves the user the need to submit, read the error message, and go back to the form to correct the information, as well as saving server resources.

There are at least two ways to do it. One is an alert or print when the submit button is clicked. Most sites also put a red asterisk or a message like *Required information by whichever input needs to be changed/filled.

Another is to use the onblur event to do the validation and warning as soon as the user leaves a field that is incorrectly filled out. This can be tricky to style.

Unfortunately, you still need to code sticky fields for js-disabled users.

If you need any hints about the javascript, you'd probably be better off asking in that thread. There are plenty of good free scripts.

As I read the original post, djeyewater intends to validate with PHP. He just wants to know if he should add a second javascript validation.

Last edited by masonbarge; Mar 7th, 2008 at 12:54.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Mar 27th, 2008, 13:03
Junior Member
Join Date: Oct 2007
Location: UK
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Worth validating with JS as well as php?

Thanks for the replies everyone, I think I will use JS as well as PHP as suggested.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Are qualifications worth it? Aesir Starting Out 19 Mar 13th, 2008 18:58
Do you think it's worth alexgeek Web Page Design 7 Aug 28th, 2007 20:52
Worth making? alexgeek Website Planning 18 Aug 7th, 2007 19:44


All times are GMT. The time now is 02:31.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42