1.★ Final term Spring 2011Lecture 443 marks
Why client side validation is used?
Show answerJawab dekhein
Client-side validation (for example with JavaScript) is used because it is fast: input is checked in the browser before the form is submitted, without a round trip to the server, which also reduces server load. It can show one error at a time and focus the wrong field, helping the user fill in all the required details correctly. (Server-side validation is still needed for security.)
2.★ Final term past paperLecture 443 marks
What refers to "this" in following statement and what is the meaning of following line in both cases if it returns true or false ?
onsubmit="return validate_Form(this)"
Show answerJawab dekhein
Here this refers to the form object itself, which is passed to the JavaScript function validate_Form. If the function returns true, the form is submitted to the server; if it returns false, submission is cancelled and the user stays on the page to correct the input.
3.★ Final term past paperLecture 443 marks
Why do we use client side validation?
Show answerJawab dekhein
Client-side validation (usually JavaScript in the browser) checks form input before it is sent to the server. It gives the user immediate feedback (e.g. a required field is empty or an email format is wrong) without a round trip, reduces unnecessary requests and server load, and can focus on the wrong field so the user corrects it. It does not replace server-side validation, because it can be bypassed.