Button [Question 1_1]
Write code to validate the information entered by the user as follows:
- Name and surname
The input must contain at least one space to be valid - NSC Information Technology - Question 1 - 2017 - Paper 1
Question 1
Button [Question 1_1]
Write code to validate the information entered by the user as follows:
- Name and surname
The input must contain at least one space to be val... show full transcript
Worked Solution & Example Answer:Button [Question 1_1]
Write code to validate the information entered by the user as follows:
- Name and surname
The input must contain at least one space to be valid - NSC Information Technology - Question 1 - 2017 - Paper 1
Step 1
Extract Name and Surname
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Retrieve the name and surname from the text box.
Check if there is at least one space in the input string. If there is no space, display a message: "The name-surname field does not contain a space."
Step 2
Extract ID Number
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Retrieve the ID number from the text box.
Check if the ID number text box is empty. If it is, display a message: "ID number must be entered."
Next, check if the ID number consists of 13 digits. If it does not, display a message: "The ID number does not consist of 13 digits."
Step 3
Validate Both Fields
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
If both the name-surname and ID number fields pass validation, set the visible property of the welcome message label to "true".