web2py forms use postbacks (the submit is directed to the same address that generated it) so the general flow is the following:
- user hits the page
- the form was not submitted nor accepted nor errored (goes to the last else)
- user fills the forms and click submit
- form was submitted: it can be accepted or errored (goes to if form.accepted or if form.errors)
From the moment user submitted the form that errored to the form rightfully compiled there is no shared state.
If you really need what you're asking (I'm quite sure that your logic may be pleased with e.g. generate a random uid just in the "accepted" branch) you need to alter the logic: persist the need of generating a new uid somewhere, i.e. the session, and then alter the default value for uid accordingly.
Or just make your own db I/O with e.g. SQLFORM.factory .