Hi All,

I am unable to write Ajax method to make a button visible and when 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-Behaviour-through-AJAX-tp3441246p3441246.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

Reply via email to