I feel the same as AlexeyKa.
Rather than running JavaScript on both client and server, I think you need to go the opposite route. Create your validation code on the server-side and use Ajax to call the validation before the form submits. That way you are using the same code to validate (no duplications) and you don't have to worry about running a JavaScript engine on your server.
Also, if you give the client the validation code that you will then run on the server, you're just asking for someone to find a hole in your validation code. Keeping validation on the server can keep your validation code away from users.
Update:
###Update: II didn't realize your question included more than validation. This isn't a PHP solution, but Google's Closure Tools is a technology that allows your client to be the same as your server. You write UI templates and define how they should work (layout, validation, persistence) and the framework creates the HTML, JavaScript and server code. This is all to ensure that you write code once and any code that is similar between client and server is handled by the framework.
I feel the same as AlexeyKa.
Rather than running JavaScript on both client and server, I think you need to go the opposite route. Create your validation code on the server-side and use Ajax to call the validation before the form submits. That way you are using the same code to validate (no duplications) and you don't have to worry about running a JavaScript engine on your server.
Also, if you give the client the validation code that you will then run on the server, you're just asking for someone to find a hole in your validation code. Keeping validation on the server can keep your validation code away from users.
###Update: I didn't realize your question included more than validation. This isn't a PHP solution, but Google's Closure Tools is a technology that allows your client to be the same as your server. You write UI templates and define how they should work (layout, validation, persistence) and the framework creates the HTML, JavaScript and server code. This is all to ensure that you write code once and any code that is similar between client and server is handled by the framework.
I feel the same as AlexeyKa.
Rather than running JavaScript on both client and server, I think you need to go the opposite route. Create your validation code on the server-side and use Ajax to call the validation before the form submits. That way you are using the same code to validate (no duplications) and you don't have to worry about running a JavaScript engine on your server.
Also, if you give the client the validation code that you will then run on the server, you're just asking for someone to find a hole in your validation code. Keeping validation on the server can keep your validation code away from users.
Update:
I didn't realize your question included more than validation. This isn't a PHP solution, but Google's Closure Tools is a technology that allows your client to be the same as your server. You write UI templates and define how they should work (layout, validation, persistence) and the framework creates the HTML, JavaScript and server code. This is all to ensure that you write code once and any code that is similar between client and server is handled by the framework.
I feel the same as AlexeyKa.
Rather than running JavaScript on both client and server, I think you need to go the opposite route. Create your validation code on the server-side and use Ajax to call the validation before the form submits. That way you are using the same code to validate (no duplications) and you don't have to worry about running a JavaScript engine on your server.
Also, if you give the client the validation code that you will then run on the server, you're just asking for someone to find a hole in your validation code. Keeping validation on the server can keep your validation code away from users.
###Update: I didn't realize your question included more than validation. This isn't a PHP solution, but Google's Closure Tools is a technology that allows your client to be the same as your server. You write UI templates and define how they should work (layout, validation, persistence) and the framework creates the HTML, JavaScript and server code. This is all to ensure that you write code once and any code that is similar between client and server is handled by the framework.
I feel the same as AlexeyKa.
Rather than running JavaScript on both client and server, I think you need to go the opposite route. Create your validation code on the server-side and use Ajax to call the validation before the form submits. That way you are using the same code to validate (no duplications) and you don't have to worry about running a JavaScript engine on your server.
Also, if you give the client the validation code that you will then run on the server, you're just asking for someone to find a hole in your validation code. Keeping validation on the server can keep your validation code away from users.
I feel the same as AlexeyKa.
Rather than running JavaScript on both client and server, I think you need to go the opposite route. Create your validation code on the server-side and use Ajax to call the validation before the form submits. That way you are using the same code to validate (no duplications) and you don't have to worry about running a JavaScript engine on your server.
Also, if you give the client the validation code that you will then run on the server, you're just asking for someone to find a hole in your validation code. Keeping validation on the server can keep your validation code away from users.
###Update: I didn't realize your question included more than validation. This isn't a PHP solution, but Google's Closure Tools is a technology that allows your client to be the same as your server. You write UI templates and define how they should work (layout, validation, persistence) and the framework creates the HTML, JavaScript and server code. This is all to ensure that you write code once and any code that is similar between client and server is handled by the framework.
I feel the same as AlexeyKa.
Rather than running JavaScript on both client and server, I think you need to go the opposite route. Create your validation code on the server-side and use Ajax to call the validation before the form submits. That way you are using the same code to validate (no duplications) and you don't have to worry about running a JavaScript engine on your server.
Also, if you give the client the validation code that you will then run on the server, you're just asking for someone to find a hole in your validation code. Keeping validation on the server can keep your validation code away from users.