View Code
Let’s learn how the view code changes that incorporate enumerations into the application.
The enumeration application’s UI for creating a new book record will contain these four choice widgets:
- A single selection list for the attribute
originalLanguage. - A multiple selection list for the attribute
otherAvailableLanguages. - A radio button group for the attribute
category. - A checkbox group for the attribute
publicationForms.
Selection lists
We use HTML selection lists to render the enumeration attributes originalLanguage and otherAvailableLanguages in the createBook.html and upateBook.html HTML forms. Since the attribute otherAvailableLanguages is multi-valued, we need a multiple-selection list, shown in the following HTML code:
The output doesn’t look too good in isolation. This will be fixed when this code is combined with the rest of the code.
While we define the select container elements for these selection lists in the HTML code of createBook.html and upateBook.html, we also fill in the option child elements dynamically in the setupUserInterface methods in v/createBook.js and v/updateBook.js with the help of the utility method util.fillSelectWithOptions ...