Hi,

because the feedback panel is not a children of the form and you only add the 
form to the AjaxRequestTarget it is not updated. 

Try to add the feedback panel to the ART in the submit, too.

kind regards

Tobias

> Am 04.09.2015 um 07:45 schrieb Mihir Chhaya <[email protected]>:
> 
> Hello,
> 
> I am finding problem while submitting form on button click.
> 
> I have simple login form with login button. User name and password fields
> are required. The button type is submit in html. But when I click the
> button the page does not show feedback messages. On clicking browser page
> refresh/reload (F5) only I see the feedback message. Could anybody suggest
> me what I am missing?
> 
> Here is the page:
> 
> public class Login extends WebPage {
> 
>    NotificationPanel feedbackPanel;
> 
>    public Login() {
> 
>        feedbackPanel = new NotificationPanel("statusbar");
>        feedbackPanel.setOutputMarkupId(true);
>        feedbackPanel.setMarkupId("statusbarId");
>        add(feedbackPanel);
> 
>        Form<Void> form = new Form<Void>("login-form"){
>            @Override
>            protected void onSubmit() {
>                super.onSubmit();
>                System.out.println("Form onSubmit called...");
>            }
>        };
>        form.setOutputMarkupId(true);
>        add(form);
>        form.add(userNameField("username", form));
>        form.add(passwordField("password", form));
>        AjaxFallbackButton submitButton = addLoginButton("login-button",
> form);
>        form.add(submitButton);
>        form.setDefaultButton(submitButton);
>        form.setOutputMarkupId(true);
>    }
> 
>    private PasswordTextField passwordField(String property, Form<Void>
> form) {
>        PasswordTextField passwordTextField = new
> PasswordTextField(property);
>        passwordTextField.setOutputMarkupId(true);
>        passwordTextField.setRequired(true);
>        passwordTextField.setMarkupId(property.concat("Id"));
> 
>        return passwordTextField;
>    }
> 
>    private RequiredTextField<String> userNameField(String property,
> Form<Void> form) {
>        RequiredTextField<String> userNameFld = new
> RequiredTextField<String>(property) {
>            @Override
>            protected void onComponentTag(ComponentTag tag) {
>                super.onComponentTag(tag);
>                if (!isValid()) {
>                    tag.put("style", "background-color:red");
>                }
>            }
>        };
>        userNameFld.setOutputMarkupId(true);
>        userNameFld.setMarkupId(property.concat("Id"));
> 
>        return userNameFld;
>    }
> 
>    private AjaxFallbackButton addLoginButton(String property, Form<Void>
> form) {
>        AjaxFallbackButton submitBtn = new AjaxFallbackButton(property,
> form) {
>            @Override
>            protected void onSubmit(AjaxRequestTarget target, Form<?> form)
> {
>                super.onSubmit(target, form);
>                target.add(form);
>            }
>        };
> 
>        submitBtn.setDefaultFormProcessing(true);
> 
>        return submitBtn;
>    }
> }
> 
> 
> Here is Mark up:
> 
> <div wicket:id="statusbar">
>        <form wicket:id="login-form">
>            <div style="width:100%">
>                <div style="display:table-row;">
>                    <div class="login-l">
>                        User Name:
>                    </div>
>                    <div class="login-t">
>                        <input type="text" wicket:id="username"
> placeholder="User Name" style="width:250px; text-align:left;">
>                    </div>
>                </div>
>                <div style="display:table-row;">
>                    <div class="login-l">
>                        Password:
>                    </div>
>                    <div class="login-t">
>                        <input type="password" wicket:id="password"
> placeholder="Password" style="width:250px; text-align:left;">
>                    </div>
>                </div>
>                <div style="display:table-row;">
>                    <div class="button-container">
>                        <input type="submit" value="Login"
> wicket:id="login-button"/>
>                    </div>
>                </div>
>            </div>
>        </form>
> 
> Thanks,
> -Mihir.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to