RE: ModalWindow and Form problems

2013-05-22 Thread Michal Wegrzyn
Anybody?

Best regards,
Michał Węgrzyn

 -Original Message-
 From: Michal Wegrzyn [mailto:michal.wegr...@onior.com]
 Sent: Wednesday, May 08, 2013 11:22
 To: users@wicket.apache.org
 Subject: ModalWindow and Form problems
 
 Hi,
 
 We are using modal window with two forms at the moment: FilterForm and
 Form (Wicket 1.5.9) (inside bean edit panel with ajax).
 FilterForm is not used at the moment (hidden filter fields).
 
 Everything works fine in IE and Firefox but in Chrome form tag is not
 rendered (only body of the form element is rendered) which causes:
 
 ERROR: Wicket.Ajax.Call.submitFormById: Trying to submit form with id
 'form27a' that is not in document.
 
 Wrapping modals in forms doesn't help. If I override isRootForm with
 false then submit succeeds, but after that forms doesn't work
 anymore.
 I think that it can be connected with nested forms and Wicket's
 ModalWindow structure. I saw several issues on Jira:
 
 https://issues.apache.org/jira/browse/WICKET-1826
 https://issues.apache.org/jira/browse/WICKET-2214
 https://issues.apache.org/jira/browse/WICKET-3404
 
 Are there any improvements in Wicket 6.x.x regarding modal forms? If
 not, are there any plans or other up-to-date issue?
 Regardless priority of old issues, it seems that it's a serious
 problem.
 
 Best regards,
 Michał Węgrzyn


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Revisit WICKET-2684?

2013-05-22 Thread John Krasnay
WICKET-2684 is titled 'Provide a way to disable Child component has a 
non-safe child id'. It was closed as invalid, but I think I have a 
use-case that wasn't considered when it was closed.


In our application we're moving to an approach of building most of our 
UI by adding panels to RepeatingViews. This allows us to build our pages 
without creating HTML files for each page, making it easy to keep HTML 
patterns consistent across the app.


As part of this strategy we've implemented a series of panels that each 
house a single input control and it's associated label. We might build a 
form like this:


---
FormPanel form = new FormPanel(newPanelId(), new 
CompoundPropertyModel(empModel));

addPanel(form);
form.addPanel(new TextFieldPanel(firstName));
form.addPanel(new TextFieldPanel(lastName));
---

addPanel(...) is a method we implement on our pages and container 
panels that simply adds the given component to a RepeatingView on the 
parent. The non-numeric child ID warning would be triggered twice here, 
for the text field panels, but these IDs are required for the example to 
work with CompoundPropertyModel.


BTW to use CompoundPropertyModel as shown above, we've created something 
called a DelegateModel:


---
public class DelegateModelT implements IModelT {

private Component component;

public DelegateModel(Component component) {
this.component = component;
}
public T getObject() {
IModelT model = (IModelT) component.getDefaultModel();
return model != null ? model.getObject() : null;
}
public void setObject(T object) {
IModelT model = (IModelT) component.getDefaultModel();
if (model != null) {
model.setObject(object);
}
}
}
---

We then create our TextFieldPanel like this:

---
public TextFieldPanel(String id) {
this(id, null);
}
public TextFieldPanel(String id, IModel model) {
super(id, model);
add(new TextField(field, new DelegateModel(this)));
}
---

This seems to work well, except for the slew of warnings about non-safe 
child IDs.


In WICKET-2684, Igor advised to use a low-level repeater where you have 
total control - RepeatingView, which we're doing, but later warned you 
do realize that if you use nonnumeric ids some things will break.


So I have two questions:

1. Is this use-case enough to re-open WICKET-2684 to remove the warning 
(or at least relocate it if, for example, ListView depends on it)? Or 
should I just silence the warning in my log4j config and move on?
2. Is there really something in AbstractRepeater/RepeatingView that 
depends on numeric IDs? I can't see anything myself, but I'd like to 
know in case it interferes with our panel-based approach.


Thanks and sorry for the longish post.

jk


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Revisit WICKET-2684?

2013-05-22 Thread Paul Bors
Take a look at how Wicket-Dashboard achieves a similar goal.
https://github.com/decebals/wicket-dashboard

In your case you would have a dashboard per form with panels for each form
field.

~ Thank you,
  Paul Bors

-Original Message-
From: John Krasnay [mailto:j...@krasnay.ca] 
Sent: Wednesday, May 22, 2013 9:50 AM
To: users@wicket.apache.org
Subject: Revisit WICKET-2684?

WICKET-2684 is titled 'Provide a way to disable Child component has a
non-safe child id'. It was closed as invalid, but I think I have a
use-case that wasn't considered when it was closed.

In our application we're moving to an approach of building most of our UI by
adding panels to RepeatingViews. This allows us to build our pages without
creating HTML files for each page, making it easy to keep HTML patterns
consistent across the app.

As part of this strategy we've implemented a series of panels that each
house a single input control and it's associated label. We might build a
form like this:

---
FormPanel form = new FormPanel(newPanelId(), new
CompoundPropertyModel(empModel)); addPanel(form); form.addPanel(new
TextFieldPanel(firstName)); form.addPanel(new TextFieldPanel(lastName));
---

addPanel(...) is a method we implement on our pages and container panels
that simply adds the given component to a RepeatingView on the parent. The
non-numeric child ID warning would be triggered twice here, for the text
field panels, but these IDs are required for the example to work with
CompoundPropertyModel.

BTW to use CompoundPropertyModel as shown above, we've created something
called a DelegateModel:

---
public class DelegateModelT implements IModelT {

 private Component component;

 public DelegateModel(Component component) {
 this.component = component;
 }
 public T getObject() {
 IModelT model = (IModelT) component.getDefaultModel();
 return model != null ? model.getObject() : null;
 }
 public void setObject(T object) {
 IModelT model = (IModelT) component.getDefaultModel();
 if (model != null) {
 model.setObject(object);
 }
 }
}
---

We then create our TextFieldPanel like this:

---
public TextFieldPanel(String id) {
 this(id, null);
}
public TextFieldPanel(String id, IModel model) {
 super(id, model);
 add(new TextField(field, new DelegateModel(this))); }
---

This seems to work well, except for the slew of warnings about non-safe
child IDs.

In WICKET-2684, Igor advised to use a low-level repeater where you have
total control - RepeatingView, which we're doing, but later warned you do
realize that if you use nonnumeric ids some things will break.

So I have two questions:

1. Is this use-case enough to re-open WICKET-2684 to remove the warning (or
at least relocate it if, for example, ListView depends on it)? Or should I
just silence the warning in my log4j config and move on?
2. Is there really something in AbstractRepeater/RepeatingView that depends
on numeric IDs? I can't see anything myself, but I'd like to know in case it
interferes with our panel-based approach.

Thanks and sorry for the longish post.

jk


-
To unsubscribe, e-mail: users-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



Re: Best way to choose different render

2013-05-22 Thread Martin Grigorov
Hi,

Use different Panel/Fragment depending on the input.


On Wed, May 22, 2013 at 5:55 PM, coincoinfou olivierandr...@gmail.comwrote:

 I'm looking for different rendering for the same component

 My template look like this :

 li
 [Label]
 nbsp;:nbsp;
 [Value]
 /li

 Wich is the best way to render for [VALUE]  toto mailto:t...@toto.fr
 when [LABEL] contain mail
 and only text if not

 I can do this in xsl with choose



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Best-way-to-choose-different-render-tp4658976.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Issue in 6.8.0 - Form with CompoundPropertyModel and AjaxSubmitLink

2013-05-22 Thread Petr Zajac

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

2013-05-22 Thread Martin Grigorov
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




Re: Issue in 6.8.0 - Form with CompoundPropertyModel and AjaxSubmitLink

2013-05-22 Thread Petr Zajac

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



Component:continueToOriginalDestination to pass parameters to original page

2013-05-22 Thread glidek
When Component:continueToOriginalDestination() is called, is there a way to
pass parameters to the original destination Wicket is redirecting to?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-continueToOriginalDestination-to-pass-parameters-to-original-page-tp4658981.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



when i click the link quickly in my page,then will show the wrong page

2013-05-22 Thread fan wang
in my project,i have a menu in my page,but when i click the menu quickly,the
will show the wrong page,,

Page Expired

The page you requested has expired.

Return to home page

THX



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/when-i-click-the-link-quickly-in-my-page-then-will-show-the-wrong-page-tp4658982.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org