Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > PHP

Reply
 
LinkBack Thread Tools
Old March 5th, 2008, 06:13 AM   #1
New Member
 

Join Date: Oct 2007
Location: UK
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 djeyewater is on a distinguished road
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.
djeyewater is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 5th, 2008, 06:41 AM   #2
Reputable Member
 

Join Date: Feb 2006
Location: Brisbane, Australia
Age: 27
Posts: 104
Thanks: 0
Thanked 1 Time in 1 Post
Rep Altering Power: 0 jimz is on a distinguished road
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.
jimz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 6th, 2008, 10:57 AM   #3
Reputable Member
 

Join Date: Jan 2008
Location: Pasig
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 sekuchi is on a distinguished road
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...
sekuchi is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 6th, 2008, 11:20 AM   #4
Aso
Most Reputable Member
 

Join Date: Oct 2007
Location: UK
Posts: 1,633
Blog Entries: 2
Thanks: 22
Thanked 84 Times in 79 Posts
Rep Altering Power: 0 Aso is on a distinguished road
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!
Aso is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 6th, 2008, 11:28 AM   #5
Reputable Member
 

Join Date: Jan 2008
Location: Pasig
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 sekuchi is on a distinguished road
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...
sekuchi is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 7th, 2008, 08:44 AM   #6
Highly Reputable Member
 
masonbarge's Avatar
 

Join Date: Jan 2006
Location: Atlanta GA
Posts: 649
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 masonbarge will become famous soon enough
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; March 7th, 2008 at 08:54 AM..
masonbarge is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 27th, 2008, 10:03 AM   #7
New Member
 

Join Date: Oct 2007
Location: UK
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 djeyewater is on a distinguished road
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.
djeyewater is offline  
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

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Your Design and Layout 19 March 13th, 2008 03:58 PM
Do you think it's worth alexgeek HTML, XHTML and CSS 7 August 28th, 2007 04:52 PM
Worth making? alexgeek How is this done? 18 August 7th, 2007 03:44 PM


Search Engine Optimization by vBSEO 3.2.0 RC8