
Learning Dart

If you have tested the Spiral 1 – the power of HTML5 forms version thoroughly, you would have come across some things that could be improved:
The HTML5 control only does its checks when the Create Account button is clicked on; it would be better if the user is alerted earlier, preferably after filling in each field.
The Birth Date value is checked to be a correct DateTime
value, but a value in the future is accepted.
The Gender field will gladly accept other values than M
or F
.
The Balance field accepts a negative number.
So HTML5 doesn't give us full validation possibilities; to remedy and supplement that, we must add code validation, see bank_terminal_s2.dart
:
For code files of this section, refer to chapter 6\bank_terminal_s2
in the code bundle.
InputElement name, address, email, birth_date, gender;
InputElement number, balance, pin_code;
void main() {
// bind variables to DOM elements:
name = querySelector('#name');
address = querySelector...
Change the font size
Change margin width
Change background colour