Re: Issue in 6.8.0 - Form with CompoundPropertyModel and AjaxSubmitLink
Hi, the JS is registered in @Override public void renderHead(IHeaderResponse response) { ClientSettings settings = new ClientSettings(getMarkupId()); response.render(OnDomReadyHeaderItem.forScript(new IJC.LoginForm( + settings.toJson() + );)); } of panel with the form. I'll try to do it like you proposed it. Thanks Petr Dne 23.5.2013 9:05, Martin Grigorov napsal(a): Hi Petr, How do you register this JS execution ? You should do it in AjaxCallListener#afterHandler because if you do it earlier then form submit wont sent the values for disabled fields. On Thu, May 23, 2013 at 12:39 AM, Petr Zajac petr.za...@gmail.com wrote: Hi Martin, thanks for the quick answer. Yes, the text fields are not empty and the parameters in requests are also empty. I found why after small investigation. The text fields are disabled after pressing submit button by using jquery in our code: $form.find('input[type=text]**').add($form.find('input[type=** password]')).attr('disabled'**, true); It looks like it's pretty danger to manipulate with input elements after submit. Have I report this issue? registration: var $form = $('form'); var $submitBtn = $form.find('input[type=**submit]'); if (!IJC.Utils.isDefined($**submitBtn.data(ui-button))) { $submitBtn.button({ icons: { primary: ui-icon-gear, secondary: ui-icon-triangle-1-s } }); } $submitBtn.click(function(e) { $submitBtn.button(option, label, Connecting.. ); $submitBtn.button(option, icons, { primary : ui-icon-clock }); $submitBtn.button(refresh); $submitBtn.button(disable); // $form.find('input[type=text]**').add($form.find('input[type=** password]')).attr('disabled'**, true); }); Petr Dne 22.5.2013 22:18, Martin Grigorov napsal(a): Hi, On Wed, May 22, 2013 at 11:07 PM, Petr Zajac petr.za...@gmail.com wrote: Hi, when I tried to upgrade to to Wicket 6.8.0 I found probably serious issue. We have Form with two text fields ('username' and 'password'). We set CompoundPropertyModel and bound properties to two textfields. The submit button uses AjaxSubmitLink. When I click to submit button the the form shows feedback that 'username' and 'password' fields cannot be empty. It works fine in 6.6.0 and 6.7.0 versions. Form implementation: form = new FormLoginFormPanel(ID_LOGIN_FORM) { private static final long serialVersionUID = 1L; private String username; private String password; @Override protected void onInitialize() { super.onInitialize(); setDefaultModel(new CompoundPropertyModelForm** LoginFormPanel(this)); usernameTF = new RequiredTextFieldString(ID_*** *USERNAME); RequiredTextField = cannot be empty usernameTF.setOutputMarkupId(true); usernameTF.add(new DefaultFocusBehavior()); add(usernameTF); add(new PasswordTextField(ID_PASSWORD)); PasswordTextField also has setRequired(true); Its javadoc states this. Do you enter data in these fields ? If YES, then check whether it is being sent to the server (Dev Tools, Firebug). If you cannot find the issue then please put this code in a quickstart app and attach it to a ticket in Jira. add(new AjaxSubmitLink(ID_SUBMIT_LINK, this) { /** */ private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { // process input } @Override protected void onError(AjaxRequestTarget target, Form? form) { // Method is invoked only if the input is invalid target.add(getPage()); } }); } Html of the form: form wicket:id=loginForm labelwicket:message key=LoginFormPanel. lbUsername //label br input type=text wicket:id=username / br br labelwicket:message key=LoginFormPanel.lbPassword //label br input type=password wicket:id=password / br br input type=submit wicket:message=value: LoginFormPanel.lbSubmit class=ui-button-process wicket:id=submitLink / /form Petr --** --**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.orghttp://apache.org users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Issue in 6.8.0 - Form with CompoundPropertyModel and AjaxSubmitLink
Hi, after fighting with registration AjaxCallListener to AjaxSubmitLink it works fine now. :-) Thanks Petr Dne 23.5.2013 13:13, Martin Grigorov napsal(a): Hi, Just re-read your previous message. I see now: $submitBtn.click(function(e) {... So you have two listeners on 'click' event on this button. Depending on which one is executed first the data will be send or not. By moving this logic in onAfter() handler you can be sure that the data is already sent when you disable the fields. On Thu, May 23, 2013 at 1:58 PM, Petr Zajac petr.za...@gmail.com wrote: Hi, the JS is registered in @Override public void renderHead(IHeaderResponse response) { ClientSettings settings = new ClientSettings(getMarkupId()); response.render(**OnDomReadyHeaderItem.**forScript(new IJC.LoginForm( + settings.toJson() + );)); } of panel with the form. I'll try to do it like you proposed it. Thanks Petr Dne 23.5.2013 9:05, Martin Grigorov napsal(a): Hi Petr, How do you register this JS execution ? You should do it in AjaxCallListener#afterHandler because if you do it earlier then form submit wont sent the values for disabled fields. On Thu, May 23, 2013 at 12:39 AM, Petr Zajac petr.za...@gmail.com wrote: Hi Martin, thanks for the quick answer. Yes, the text fields are not empty and the parameters in requests are also empty. I found why after small investigation. The text fields are disabled after pressing submit button by using jquery in our code: $form.find('input[type=text]').add($form.find('input[**type=** password]')).attr('disabled', true); It looks like it's pretty danger to manipulate with input elements after submit. Have I report this issue? registration: var $form = $('form'); var $submitBtn = $form.find('input[type=submit]'); if (!IJC.Utils.isDefined($submitBtn.data(ui-button))) { $submitBtn.button({ icons: { primary: ui-icon-gear, secondary: ui-icon-triangle-1-s } }); } $submitBtn.click(function(e) { $submitBtn.button(option, label, Connecting.. ); $submitBtn.button(option, icons, { primary : ui-icon-clock }); $submitBtn.button(refresh); $submitBtn.button(disable); // $form.find('input[type=text]').add($form.find('input[**type=** password]')).attr('disabled', true); }); Petr Dne 22.5.2013 22:18, Martin Grigorov napsal(a): Hi, On Wed, May 22, 2013 at 11:07 PM, Petr Zajac petr.za...@gmail.com wrote: Hi, when I tried to upgrade to to Wicket 6.8.0 I found probably serious issue. We have Form with two text fields ('username' and 'password'). We set CompoundPropertyModel and bound properties to two textfields. The submit button uses AjaxSubmitLink. When I click to submit button the the form shows feedback that 'username' and 'password' fields cannot be empty. It works fine in 6.6.0 and 6.7.0 versions. Form implementation: form = new FormLoginFormPanel(ID_LOGIN_**FORM) { private static final long serialVersionUID = 1L; private String username; private String password; @Override protected void onInitialize() { super.onInitialize(); setDefaultModel(new CompoundPropertyModelForm** LoginFormPanel(this)); usernameTF = new RequiredTextFieldString(ID_* *USERNAME); RequiredTextField = cannot be empty usernameTF.setOutputMarkupId(**true); usernameTF.add(new DefaultFocusBehavior()); add(usernameTF); add(new PasswordTextField(ID_PASSWORD)**); PasswordTextField also has setRequired(true); Its javadoc states this. Do you enter data in these fields ? If YES, then check whether it is being sent to the server (Dev Tools, Firebug). If you cannot find the issue then please put this code in a quickstart app and attach it to a ticket in Jira. add(new AjaxSubmitLink(ID_SUBMIT_LINK, this) { /** */ private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { // process input } @Override protected void onError(AjaxRequestTarget target, Form? form) { // Method is invoked only if the input is invalid target.add(getPage()); } }); } Html of the form: form wicket:id=loginForm labelwicket:message key=LoginFormPanel. lbUsername //label br input type=text wicket:id=username / br br labelwicket:message
Issue in 6.8.0 - Form with CompoundPropertyModel and AjaxSubmitLink
Hi, when I tried to upgrade to to Wicket 6.8.0 I found probably serious issue. We have Form with two text fields ('username' and 'password'). We set CompoundPropertyModel and bound properties to two textfields. The submit button uses AjaxSubmitLink. When I click to submit button the the form shows feedback that 'username' and 'password' fields cannot be empty. It works fine in 6.6.0 and 6.7.0 versions. Form implementation: form = new FormLoginFormPanel(ID_LOGIN_FORM) { private static final long serialVersionUID = 1L; private String username; private String password; @Override protected void onInitialize() { super.onInitialize(); setDefaultModel(new CompoundPropertyModelFormLoginFormPanel(this)); usernameTF = new RequiredTextFieldString(ID_USERNAME); usernameTF.setOutputMarkupId(true); usernameTF.add(new DefaultFocusBehavior()); add(usernameTF); add(new PasswordTextField(ID_PASSWORD)); add(new AjaxSubmitLink(ID_SUBMIT_LINK, this) { /** */ private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { // process input } @Override protected void onError(AjaxRequestTarget target, Form? form) { // Method is invoked only if the input is invalid target.add(getPage()); } }); } Html of the form: form wicket:id=loginForm labelwicket:message key=LoginFormPanel.lbUsername //label br input type=text wicket:id=username / br br labelwicket:message key=LoginFormPanel.lbPassword //label br input type=password wicket:id=password / br br input type=submit wicket:message=value:LoginFormPanel.lbSubmit class=ui-button-process wicket:id=submitLink / /form Petr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Issue in 6.8.0 - Form with CompoundPropertyModel and AjaxSubmitLink
Hi Martin, thanks for the quick answer. Yes, the text fields are not empty and the parameters in requests are also empty. I found why after small investigation. The text fields are disabled after pressing submit button by using jquery in our code: $form.find('input[type=text]').add($form.find('input[type=password]')).attr('disabled', true); It looks like it's pretty danger to manipulate with input elements after submit. Have I report this issue? registration: var $form = $('form'); var $submitBtn = $form.find('input[type=submit]'); if (!IJC.Utils.isDefined($submitBtn.data(ui-button))) { $submitBtn.button({ icons: { primary: ui-icon-gear, secondary: ui-icon-triangle-1-s } }); } $submitBtn.click(function(e) { $submitBtn.button(option, label, Connecting.. ); $submitBtn.button(option, icons, { primary : ui-icon-clock }); $submitBtn.button(refresh); $submitBtn.button(disable); // $form.find('input[type=text]').add($form.find('input[type=password]')).attr('disabled', true); }); Petr Dne 22.5.2013 22:18, Martin Grigorov napsal(a): Hi, On Wed, May 22, 2013 at 11:07 PM, Petr Zajac petr.za...@gmail.com wrote: Hi, when I tried to upgrade to to Wicket 6.8.0 I found probably serious issue. We have Form with two text fields ('username' and 'password'). We set CompoundPropertyModel and bound properties to two textfields. The submit button uses AjaxSubmitLink. When I click to submit button the the form shows feedback that 'username' and 'password' fields cannot be empty. It works fine in 6.6.0 and 6.7.0 versions. Form implementation: form = new FormLoginFormPanel(ID_LOGIN_**FORM) { private static final long serialVersionUID = 1L; private String username; private String password; @Override protected void onInitialize() { super.onInitialize(); setDefaultModel(new CompoundPropertyModelForm** LoginFormPanel(this)); usernameTF = new RequiredTextFieldString(ID_**USERNAME); RequiredTextField = cannot be empty usernameTF.setOutputMarkupId(**true); usernameTF.add(new DefaultFocusBehavior()); add(usernameTF); add(new PasswordTextField(ID_PASSWORD)**); PasswordTextField also has setRequired(true); Its javadoc states this. Do you enter data in these fields ? If YES, then check whether it is being sent to the server (Dev Tools, Firebug). If you cannot find the issue then please put this code in a quickstart app and attach it to a ticket in Jira. add(new AjaxSubmitLink(ID_SUBMIT_LINK, this) { /** */ private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { // process input } @Override protected void onError(AjaxRequestTarget target, Form? form) { // Method is invoked only if the input is invalid target.add(getPage()); } }); } Html of the form: form wicket:id=loginForm labelwicket:message key=LoginFormPanel.**lbUsername //label br input type=text wicket:id=username / br br labelwicket:message key=LoginFormPanel.**lbPassword //label br input type=password wicket:id=password / br br input type=submit wicket:message=value:**LoginFormPanel.lbSubmit class=ui-button-process wicket:id=submitLink / /form Petr --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org