Skip to main content
June 11, 2009
Question

Question regarding form validation

  • June 11, 2009
  • 4 replies
  • 1011 views

I know that JavaScript client side form validation is not recommended because people may disable their JavaScript.

Now I have done my form validation with JavaScript but the JavaScript calls are embedded in a php page (or php source file).

Since php files are run on the server side, can I assume that my JavaScript validations (which are part of  a php file) will be done on the server side as well, and therefore are secure?  In other words are JavaScript calls invoked from php files run on the server side since php files are run on the server side?

This question may be evident for many of you, but I am new at web development and would appreciate some clarification on this.

Thanks.

This topic has been closed for replies.

4 replies

June 25, 2009

I have implemented both client side JavaScript validation and server side php validation.

Participating Frequently
June 11, 2009

>I know that JavaScript client side form validation is not

>recommended because people may disable their JavaScript.

Just to clarify this a bit, client side validation can sometimes be very helpful to the visitor as it can provide faster feedback. However, it should always be used in addition to server side validation as it is not easily defeated.

David_Powers
Inspiring
June 11, 2009

savmoy wrote:

Since php files are run on the server side, can I assume that my JavaScript validations (which are part of  a php file) will be done on the server side as well, and therefore are secure?

No. The PHP server processes the PHP only, and then sends the output to the browser, which is where the JavaScript will be executed.

June 11, 2009

Thanks for the response David.

By the way I just bought your book on CS4. It is great. Just finished

implementing sticky keys based on the info in the book. It was really easy.

DwFAQ
Participating Frequently
June 11, 2009

Your situation will become clear when you disable javascript on your browser and test your form online yourself, no?

June 11, 2009

Thanks for the response. You are quite right. As I said I am new at

this....But I am learning.