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.
|
|
|
|
|
![]() |
||
Worth validating with JS as well as php?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
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. |
|
|
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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...
|
|
#4
|
||||
|
||||
|
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)
|
|
#5
|
|||
|
|||
|
Re: Worth validating with JS as well as php?
Quote:
|
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
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.
|
![]() |
| Thread Tools | |
|
|
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 |