For Squash Logs, validations need to be implemented at run-time, so that it is very easy for the player to enter his log data, after each game he plays. We designed the form, so that it was extremely simple for end user to update it.
The below client validations are implemented :
(*) Save button is hidden till all mandatory data is entered.
(*) Date control is shown. Future date cannot be selected for match logs. Date displayed is as per the format required.
(*) Total Score cannot exceed 5. Hence if any one opponent, enters a score of 3, the other opponent can only enter a score of 0,1 or 2.
(*) If Scoring System is Selected as “HiHo”, then Games To are always set to 9. If Scoring System is Selected as “PAR”, then Games To, can be selected as either 11 or 15.
(*) Notes cannot exceed 500 characters. Number of pending characters are shown during typing.
(*) Weight Must be Positive number.
(*) All users Locations are detected and loaded in the drop-down box.
(*) Any Location can be selected from all the Location created. In the select box, we have an option as “New Location”. If this is selected, then an input box is shown to enter the location name. This is mandatory only if “New Location” is selected from drop-down. Save logic is implemented accordingly.
(*) All users Opponents are detected and loaded in the select box.
(*) Any Opponent can be selected from all the Opponents created. In the select box, we have an option as “New Opponent”. If this is selected, then an input box is shown to enter the opponent name. This is mandatory only if “New Opponent” is selected from drop-down. Save logic is implemented accordingly.
(*) Either entering a new opponent, or selecting one is mandatory.
(*) The users last entered details are retrieved via cookie and are auto-filled next time. He does not have to re-enter his common details again. If user is accessing the dashboard, from different systems, then the last entered details are fetched from the server. This way even without a cookie, he does get his details auto-filled in.
The same validations were implemented on server side, to ensure no one can push through any irrelevant data.
You can read more about this project here.