You do validation at each phase, but for slightly different reasons.
You validate when the user sets a value in order to provide immediate feedback to the user about whether the input is valid. That validation should only be used to enhance the user experience. You can validate while the user is typing if that's appropriate, but be sure not to prevent the user from entering invalid partial input, since there might be more coming and you don't want the validation to get in the way.
You validate before the user submits the form in order to ensure that the submission will be valid without incurring the time cost of a full round-trip to the server. This would mainly be for things that weren't or couldn't be validated during user entry, and it might involve some communication with the server, to check whether a username is available for example, without reloading the page. This stage is also mainly for the user's benefit. Whether you validate each item during entry or on submit is up to you and should depend on which provides a better user experience and better fits the user's mental model.
Finally, you need to validate everything when it comes back to the server because you can't trust the browser. This validation is mainly for security. You can never assume that any data coming from your client is clean because it might not be coming from your client. It could be coming from a hostile agent that's emulating your client. So validate everything, completely, for all potential exploits and other invalid conditions, regardless of whether it was validated in the client.
Hope that helps.