Client-side and server-side unified validation
A system and method for validating code on a client-side and on a server-side in a Web environment utilizes a single validation code to validate JavaScript code on a client-side and JavaScript code on a server-side of a computer network system. The single validation code can help to correct errors in the client code and ensure the integrity of data stored on the server.
1. A computer implemented method for validating code on a client-side and on a server-side in a web environment, the method comprising:
providing a JavaScript code on a client-side;
providing a JavaScript code on a server-side; and
validating both the JavaScript code on the client-side and the JavaScript code on the server-side with a single validation code on the client-side and the server-side;
injected a proxy code into the JavaScript code on the client-side, the proxy code calling the single validation code on the server-side;
filtering code submitted from the client-side to the server-side;
validating the code that has been filtered; and
submitting the code that has been filtered to a second server-side software.
2. The method according to claim 1 wherein the second server-side software is implemented in JAVA, PHP, C#, PYTHON or RUBY programming language.
3. A web environment comprising:
a web-server comprising a web-server processor running a server-side JavaScript code; and
a single validation code on the client-side and the server-side, the single validation code validating the server-side JavaScript code and client-side JavaScript code included in a web browser running on a client processor;
a proxy code injected into the client-side JavaScript code, the proxy-code calling the single validation code on the server-side; and
a code on a client-side that is filtered and submitted to the server-side wherein the code is validated and submitted to a second server-side software.
4. The web environment according to claim 3 wherein the second server-side software is implemented in JAVA, PHP, C#, PYTHON or RUBY programming language.
5. A system for validating code on a client-side and on a server-side in a web environment, the system comprising:
a web-server comprising a web-server processor running a server-side JavaScript code for a HTML document;
a single validation code on the client-side and the server-side, the single validation code validating the server-side JavaScript code and client-side JavaScript code included in a web browser running on a client processor;
a proxy code injected into the client-side JavaScript code, the proxy-code calling the single validation code on the server-side; and
a code on a client-side that is filtered and submitted to the server-side wherein the code is validated and submitted to a second server-side software.
6. The system according to claim 5 wherein the a second server-side software is implemented in JAVA, PHP, C#, PYTHON or RUBY programming language.
7. The system according to claim 5 further comprising a network.
8. A system according to claim 5 further comprising
a JavaScript architecture in a Web-server.
9. A computer implemented method comprising:
injecting proxy code into a JavaScript code of an HTML document for on a client-side, the proxy code comprising code that makes a call to a validation code at a server-side;
providing to the client-side the HTML document comprising the proxy code that makes the call to the validation code at the server-side;
in response to the call, validating data input to the HTML document at the client-side with the validation code at the server-side;
after the validating data input to the HTML document, receiving a submission of the HTML document; and
validating the submission with the validation code at the server-side, wherein the validation code for the validating the submission is the same validation code for the validating data input to the HTML document at the client-side
filtering code submitted from the client-side to the server-side;
validating the code that has been filtered; and
submitting the code that has been filtered to a second server-side software.
10. The method of claim 9 wherein the validation code for the validating the submission comprises logic, and the validation code for the validating the data input to the HTML document at the client-side comprises the same logic.
11. The method of claim 9 wherein the validation code for the validating the submission is identical to the validation code for the validating the data input to the HTML document at the client-side.
12. The method of claim 9 wherein executing the validation code at the server-side throws an error when the data input to the HTML document at the client-side is invalid.
13. The method of claim 9 wherein the validation code comprises a <script> tag.