you are adding two behaviors to the same button that both compete for the
onclick attribute - a formcomponentupdatingbehavior and
ajaxformsubmitbehavior. you have two choices:

create a compound behavior out of the two

or let the ajaxformsubmitbehavior implement iajaxindicatoraware directly

-igor


On 3/1/07, Apaar Trivedi <[EMAIL PROTECTED]> wrote:

 I have setup an AjaxIndicator to show up when I press a button, but the
onclick event seems to be overridden when I set this up.  For my button, the
onclick event is tied to a form submit, causing the form to update.  But
when I had an onclick behavior which pops up the indicator, the form no
longer gets submitted, but the indicator does pop up.



how can I also make the form submit happen for an onclick?  Below is the
code which I am referring to:



public class AjaxIndicator extends WebMarkupContainer{



        public AjaxIndicator (String id){

            super(id);

            setOutputMarkupId(true);

        }



        /* (non-Javadoc)

         * @see wicket.Component#onComponentTag(wicket.markup.ComponentTag
)

         */

        protected void onComponentTag(ComponentTag tag) {

            // TODO Auto-generated method stub

            super.onComponentTag(tag);

            tag.put("src", "
http://localhost:8080/dell-ren/i/temp/ajax-loader.gif";);



        }

    }





private void setupPanel() {



            final AjaxIndicator imgContainer = new
AjaxIndicator("indicatorImg");

    form.add (imgContainer);



        class usersOrGroupsBehavior extends
AjaxFormComponentUpdatingBehavior implements IAjaxIndicatorAware {

            usersOrGroupsBehavior(){

                super("onclick");

            }



            /* (non-Javadoc)

             * @see
wicket.ajax.IAjaxIndicatorAware#getAjaxIndicatorMarkupId()

             */

            public String getAjaxIndicatorMarkupId() {

                return imgContainer.getMarkupId();

            }



            /* (non-Javadoc)

             * @see
wicket.ajax.form.AjaxFormComponentUpdatingBehavior#onUpdate(
wicket.ajax.AjaxRequestTarget)

             */

            protected void onUpdate(AjaxRequestTarget arg0) {



                try {

                    Thread.sleep(5000);

                } catch (InterruptedException e) {

                }



            }

        }





        Button searchButton = new Button("searchButton", new
StringResourceModel("searchButton", this, null));

        searchButton.add(new AjaxFormSubmitBehavior(form, "onclick") {

            protected void onSubmit(AjaxRequestTarget target) {

                try {

                    Thread.sleep(5000);

                } catch (InterruptedException e) {

                    throw RenRuntimeException.wrapWithRenRuntimeException
(e);

                }

                Collection ldapUsers =
getUsersOrGroupsFromLdap(getLdapQuery(), getGroupsToSearchWithin());

                populateUsersOrGroupsList(ldapUsers);



                // make the add button visible once we've populated the
selectable users list

                addButton.setVisible(true);

                target.addComponent(UserGroupPickerPanel.this);



            }

        });



        searchButton.add(new usersOrGroupsBehavior());

}

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to