You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by vn0058212 <vn...@techmahindra.com> on 2011/04/11 09:11:25 UTC
Re: CheckBox handling with Ajax.
Hi All,
I am unable to write Ajax method to make a button visible and unchecked it
should'nt be made visible.
heres my bit of code,
1.) this is like a PoP screen which comes up and i need to check the
checkbox and after which the button will be made visible and also if
unchecked it should made invisible
add(new CheckBox("A", new Model() {
@Override
public Object getObject() {
return B;
}
@Override
public void setObject(Object object) {
B= (Boolean) object;
}
}));
@Override
public boolean isVisible() {
// TODO Auto-generated method stub
return super.isVisible() && bean == null && !B;
}
@Override
protected void onSubmit() {
if (log.isDebugEnabled())
log.debug(String.format("Accepted terms of use? %b", B));
if (!B) {
error(getLocalizer().getString("errors.XYZ.termsOfUseNotaccepted",
Filename.this, "Please accept terms of use to proceed"));
return;
}
}
2.) Now this is my bit o code after i hit the button successfully and i will
abe to view the page to upload some data,
@Override
public boolean isVisible() {
// TODO Auto-generated method stub
return super.isVisible() && B;
}
@Override
protected void onSubmit() {
Filename.this.resetModel();
FileUpload upload = fileUploadField.getFileUpload();
if (log.isDebugEnabled())
log.debug(String.format("Submitted file upload: %s", upload));
if (upload == null) {
error(getLocalizer().getString("mapviewer.excel.no_data", Filename.this,
"Please choose a file."));
return;
}
What do suggest me to do going forward?
Thanks,
Varun
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckBox-handling-with-Ajax-tp1869728p3441242.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org