Hi,
you have to use org.apache.wicket.markup.html.form.*Check* inside your
CheckGroup, not Checkboxes.
Have fun
Sven
On 25.01.2017 20:35, SeldonCrisis wrote:
Hi,
I'm trying to implement some *Ajax* on a *CheckGroup* containing two check
boxes. The purpose of this Ajax Event is to enable/disable a form button
depending on whether or not the checkboxes in the CheckGroup are true/false
(their models).
Unfortunately, I can't get anything in the onUpdate() to run, and when I
toggle a breakpoint on onUpdate() I don't actually reach it. Instead, I get
a message in the Ajax Debug Window:
INFO: focus set on cg1-cb1
INFO: Ajax request stopped because of precondition check, url:
./submit?3-5.IBehaviorListener.0-form-fileClaimContainer-cg1
INFO: focus removed from cg1-cb1
*Here's the relevant Java: *
fileClaimContainer = new WebMarkupContainer("fileClaimContainer");
fileClaimContainer.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).setVisible(true);
final Button fileClaimButton;
final CheckBox cb1 = new CheckBox("cg1-cb1", new Model<Boolean>(false));
final CheckBox cb2 = new CheckBox("cg1-cb2", new Model<Boolean>(false));
fileClaimButton = new Button("fileClaimButton");
fileClaimButton.setOutputMarkupId(true);
fileClaimButton.setOutputMarkupPlaceholderTag(true);
CheckGroup cg1 = new CheckGroup("cg1", new Model());
cg1.setOutputMarkupId(true);
cg1.setOutputMarkupPlaceholderTag(true);
cg1.add(cb1, cb2);
cg1.add(new AjaxFormChoiceComponentUpdatingBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (!cb1.getModelObject() || !cb2.getModelObject())
fileClaimButton.setEnabled(false);
else
fileClaimButton.setEnabled(true);
target.add(fileClaimButton);
}
});
fileClaimContainer.add(fileClaimButton);
fileClaimContainer.add(cg1);
*And heres the HTML: *
<div wicket:id = "fileClaimContainer">
<ul wicket:id="cg1" class="checkboxgroup" id="cg1" role="checkboxgroup">
<li>
<input type="checkbox" wicket:id="cg1-cb1" id="cg1-cb1"
name="cg1-cb1"
value="true" aria-labelledby="cb1_label" aria-required="true">
<label id="cb1_label" for="cg1-cb1">Label 1</label>
</li>
<li>
<input type="checkbox" wicket:id="cg1-cb2" id="cg1-cb2"
name="cg1-cb2"
value="true" aria-labelledby="cb2_label" aria-required="true">
<label id="cb2_label" for="cg1-cb2">Label 2</label>
</li>
</ul>
<small>Warning</small><br></br>
<div class="frm-contbtns">
<input class="btn-sbmt" wicket:id="fileClaimButton"
type="submit"
value="File This Petition" />
</div>
</div>
I found that many questions similar to this have been asked here before, and
I've looked through those past forum posts for a solution, but I'm quite new
to Wicket and I'm having trouble applying those solutions to my problem. I
would really appreciate any help I could get here. Thanks!
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Ajax-request-stopped-because-of-precondition-check-on-CheckGroup-tp4676865.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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org