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 va... 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 from textbox
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
First, retrieve the name and surname entered by the user. Check if there is at least one space included in the input. If no space is found, display a dialog message stating that 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
Next, extract the ID number from the input field. If the ID number field is empty, display a message indicating that the ID number must be entered. If the ID number entered does not consist of exactly 13 digits, show an appropriate error message indicating that the ID number does not contain 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
Before moving forward, ensure both the name-surname string contains a space and the ID number consists of 13 digits. If both validations pass, set the welcome message label to be visible.