Github user jmewes commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/341#discussion_r235874202
  
    --- Diff: 
wicket-user-guide/src/main/asciidoc/modelsforms/modelsforms_4.adoc ---
    @@ -85,18 +85,18 @@ Inside form's constructor we build the three components 
used in the form and we
     [source,java]
     ----
     usernameField = new TextField("username", Model.of(""));
    -passwordField = new PasswordTextField("password", Model.of(""));           
        
    +passwordField = new PasswordTextField("password", Model.of(""));
     loginStatus = new Label("loginStatus", Model.of(""));
     ----
     
     If we don't provide a model to a form component, we will get the following 
exception on form submission:
     
     [source,java]
     ----
    -java.lang.IllegalStateException: Attempt to set model object on null model 
of component: 
    +java.lang.IllegalStateException: Attempt to set model object on null model 
of component:
     ----
     
    -Component TextField corresponds to the standard text field, without any 
particular behavior or restriction on the allowed values. We must bind this 
component to the <input> tag with the attribute type set to "text" 
PasswordTextField is a subtype of TextFiled and it must be used with an <input> 
tag with the attribute type set to "password". For security reasons component 
PasswordTextField cleans its value at each request, so it will be always empty 
after the form has been rendered. By default PasswordTextField fields are 
required, meaning that if we left them empty, the form won't be submitted (i.e. 
_onSubmit_ won't be called). Class FormComponent provides method 
_setRequired(boolean required)_ to change this behavior. Inside _onSubmit_, to 
get/set model objects we have used shortcut methods _setDefaultModelObject_ and 
_getDefaultModelObject_. Both methods are defined in class Component (see class 
diagram from Illustration 9.1).
    +Component TextField corresponds to the standard text field, without any 
particular behavior or restriction on the allowed values. We must bind this 
component to the <input> tag with the attribute type set to "text" 
PasswordTextField is a subtype of TextFiled and it must be used with an <input> 
tag with the attribute type set to "password". For security reasons component 
PasswordTextField cleans its value at each request, so it will be always empty 
after the form has been rendered. By default PasswordTextField fields are 
required, meaning that if we left them empty, the form won't be submitted (i.e. 
_onSubmit_ won't be called). Class FormComponent provides method 
_setRequired(boolean required)_ to change this behavior. Inside _onSubmit_, to 
get/set model objects we have used shortcut methods _setDefaultModelObject_ and 
_getDefaultModelObject_. Both methods are defined in class Component (see class 
diagram from illustration 9.1).
    --- End diff --
    
    > see class diagram from Illustration 9.1).
    
    "Illustration" doesn't need to be in upper case.


---

Reply via email to