-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
D Web Development
By :
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.
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 form) { /* ... */ }The getError() method takes a _error parameter, which receives information about the error. In the simplest cases, the type of the parameter is string and contains an error message. Note the underscore in the parameter name...
Change the font size
Change margin width
Change background colour