O'Reilly logo

D Web Development by Kai Nacke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating user input

With the use of the web framework, the application implicitly checks that the form fields for the topic and content text are present. The check happens at the time the framework populates the FormData struct with the values of the form fields. There is no way to display this error yet. If you remove one of the form fields and run the application, then the application seems to crash. As the same approach is used to validate user input, we need to fix this.

Displaying error messages with @errorDisplay

If an error occurs, then a web page must be rendered to show the error message. You use the @errorDisplay annotation to define the function to be called in order to display the error:

@errorDisplay!getError void createNewNote(FormData ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required