Released June 2010 For Assessment Submission January 2013 to

advertisement
Released June 2010
For Assessment Submission
January 2013 to June 2015
GCSE COMPUTING
A452
Validating Web Forms
* A 4 2 6 2 9 0 6 1 2 *
CONTROLLED ASSESSMENT MATERIAL 2
This assessment may be periodically
reviewed. Please check on OCR
Interchange that you have the Controlled
Assessment material valid for the
appropriate assessment session.
*
A
4
5
2
*
INSTRUCTIONS TO TEACHERS
•
•
•
•
•
Please refer to Section 4 of the GCSE Computing specification for instructions on
completing this controlled assessment task.
Each task can be contextualised appropriately to suit facilities available in your centre.
The marking criteria should be available to candidates whilst completing the task.
The quality of written communication will be assessed in the judgements and conclusion
section.
The total number of marks for this unit is 45.
INFORMATION FOR CANDIDATES
•
This document consists of 8 pages. Any blank pages are indicated.
Teachers are responsible for ensuring that assessment is carried out against the
Controlled Assessment set for the relevant examination series (detailed above).
Assessment evidence produced that does not reflect the relevant examination series
will not be accepted.
© OCR 2010 [Y/600/3256]
DC (AC/DJ) 64632/1
OCR is an exempt Charity
Turn over
2
The purpose of this unit is to carry out a practical investigation of a topic chosen from a set of options
supplied by OCR. In the course of the investigation, there will be an opportunity to look in depth at an
aspect of computing that goes beyond the subject matter outlined in A451. The tasks will require a
significant element of practical activity, which must be evidenced in the report and which will form a
major element of the assessment. The topics will enable practical investigation and some supplementary
research to be carried out in a variety of ways. These will include, but are not restricted to:
•
practical investigations with hardware or software
•
practical investigations with online resources
Supplementary research may be required and resources may include:
•
web-based enquiry
•
contact with IT professionals
•
research using computer industry publications
© OCR 2010
A452 Jan13/Jun15
3
Candidates should complete all tasks.
Validating web forms
Many web sites collect information from people using forms. These forms can be put together using
HTML form objects. The data entered is normally sent back to the web server where it is processed by
database software. It is always a good idea if the data entered into a computer system is validated in
order to reduce the number of errors that occur. A lot of this validation can be carried out at the client
end of the process. In other words, processing can be carried out by the browser. There are various
ways in which this can be done. A common way is to write scripts that intercept the input data and
check it before it is submitted to the server. There are various scripting languages that can be used to
write the necessary validation routines. A popular example is JavaScript. Most browsers are able to
interpret JavaScript. JavaScript, just like other elements of a web page, is best written using a plain text
editor such as Notepad. Scripts can be embedded in a web page or saved separately as JavaScript
files, using the extension js. The web page can access these scripts when needed.
Here is the starting point for a form that collects information about exam entries.
File
Edit
View
History
Bookmarks
Tools
Help
http://examentry.net
Exam entry
Exam Entry Form
Name
Subject
Submit
Reset
Fig. 1
It contains two text boxes. When the Submit button is clicked, a script checks that both boxes have
been filled in.
Here is the HTML code that lies behind the form and the JavaScript code that does the validation.
<head>
<title>Exam entry</title>
<script language=”javascript” type=”text/javascript”>
function validateForm() {
var result = true;
var msg=””;
if (document.ExamEntry.name.value==””) {
msg+=”You must enter your name \n”;
document.ExamEntry.name.focus();
document.getElementById(‘name’).style.color=”red”;
result = false;
}
© OCR 2010
A452 Jan13/Jun15
Turn over
4
if (document.ExamEntry.subject.value==””) {
msg+=”You must enter the subject \n”;
document.ExamEntry.subject.focus();
document.getElementById(‘subject’).style.color=”red”;
result = false;
}
if(msg==””){
return result;
}
{
alert(msg)
return result;
}
}
</script>
</head>
<body>
<h1>Exam Entry Form</h1>
<form name=”ExamEntry” method=”post” action=”success.html”>
<table width=”50%” border=”0”>
<tr>
<td id=”name”>Name</td>
<td><input type=”text” name=”name” /></td>
</tr>
<tr>
<td id=”subject”>Subject</td>
<td><input type=”text” name=”subject” /></td>
</tr>
<tr>
<td><input type=”submit” name=”Submit” value=”Submit” onclick=”return
validateForm();” /></td>
<td><input type=”reset” name=”Reset” value=”Reset” /></td>
</tr>
</table>
</form>
</body>
In order to work, the page needs to have access to a second HTML file called success.html. Its purpose
is to test the code. It just needs four lines:
<head>
<title>Success message</title>
</head>
<body>
<H1> You entered all the data required </H1>
</body>
© OCR 2010
A452 Jan13/Jun15
5
Your assignment
1.
Describe how this HTML code produces the form displayed in the browser (Fig. 1).
2.
Describe how the JavaScript function performs the validation check.
3.
Describe how the HTML calls the validation routine.
4.
(i)
Add another text field to the form to take the user’s examination number.
(ii)
Extend the Javascript code to validate this field to make sure that it is not left blank.
(iii)
Extend the Javascript code to make sure that the user’s examination number is exactly
4 digits.
Produce evidence to show that you have planned, written and tested your code.
5.
Add a set of radio buttons to the form to accept a level of entry such as GCSE, AS or A2. Write a
function that displays the level of entry to the user in an alert box so that the level can be confirmed
or rejected.
Produce evidence to show that you have planned, written and tested your code.
6.
Produce an evaluation of your solutions.
7.
Write a conclusion about the effectiveness of JavaScript validation routines to reduce the number
of errors that are made in data input.
© OCR 2010
A452 Jan13/Jun15
6
BLANK PAGE
© OCR 2010
A452 Jan13/Jun15
7
BLANK PAGE
© OCR 2010
A452 Jan13/Jun15
8
Copyright Information
OCR is committed to seeking permission to reproduce all third-party content that it uses in its assessment materials. OCR has attempted to identify and contact all copyright holders
whose work is used in this paper. To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced in the OCR Copyright
Acknowledgements Booklet. This is produced for each series of examinations, is given to all schools that receive assessment material and is freely available to download from our public
website (www.ocr.org.uk) after the live examination series.
If OCR has unwittingly failed to correctly acknowledge or clear any third-party content in this assessment material, OCR will be happy to correct its mistake at the earliest possible
opportunity.
For queries or further information please contact the Copyright Team, First Floor, 9 Hills Road, Cambridge CB2 1GE.
OCR is part of the Cambridge Assessment Group; Cambridge Assessment is the brand name of University of Cambridge Local Examinations Syndicate (UCLES), which is itself a
department of the University of Cambridge.
© OCR 2010
A452 Jan13/Jun15
Download