You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wicket_new_user <mu...@gmail.com> on 2013/02/08 11:11:18 UTC

How to set defaultProcessing for AjaxFormSubmitBehavior

Hi,
i'm having an issue where the form is getting submitted, when
AjaxFormSubmitBehavior is being used.

I see we can avoid the form submission (validation part) when we set
defaultProcessing to false.

Below is my snippet of code.

*private final class SelectorUpdateBehavior extends AjaxFormSubmitBehavior
    {
        private static final long serialVersionUID = 1L;

        private final IModel<T> entityModel;
        private final IModel<Collection&lt;T>> model;
        private final boolean defaultProcessing;

        @SuppressWarnings("unchecked")
        private SelectorUpdateBehavior(final IModel<? extends Collection<T>>
model, final IModel<T> entityModel, final boolean defaultProcessing)
        {
            super("onchange");
            this.entityModel = entityModel;
            this.model = (IModel<Collection&lt;T>>) model;
            this.defaultProcessing = defaultProcessing;
        }
        
        /** {@inheritDoc} */
        @Override
        protected void onError(final AjaxRequestTarget target)
        {
        	throw new RuntimeException();
        }
        
        /** {@inheritDoc} */
        @Override
        protected void onSubmit(final AjaxRequestTarget target)
        {
            // code goes here
        }
    }*

Please suggest me how to set the defaultProcessing to false in the above.

thanks in advance
WNU



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-set-defaultProcessing-for-AjaxFormSubmitBehavior-tp4656202.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


Re: How to set defaultProcessing for AjaxFormSubmitBehavior

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
There is a method AjaxFormSubmitBehavior#getDefaultProcessing

/**
 * @see Button#getDefaultFormProcessing()
 *
 * @return {@code true} for default processing
 */
public boolean getDefaultProcessing()
{
return defaultProcessing;
}

Did you try  overriding that?

On Fri, Feb 8, 2013 at 11:11 AM, wicket_new_user <mu...@gmail.com>wrote:

> Hi,
> i'm having an issue where the form is getting submitted, when
> AjaxFormSubmitBehavior is being used.
>
> I see we can avoid the form submission (validation part) when we set
> defaultProcessing to false.
>
> Below is my snippet of code.
>
> *private final class SelectorUpdateBehavior extends AjaxFormSubmitBehavior
>     {
>         private static final long serialVersionUID = 1L;
>
>         private final IModel<T> entityModel;
>         private final IModel<Collection&lt;T>> model;
>         private final boolean defaultProcessing;
>
>         @SuppressWarnings("unchecked")
>         private SelectorUpdateBehavior(final IModel<? extends
> Collection<T>>
> model, final IModel<T> entityModel, final boolean defaultProcessing)
>         {
>             super("onchange");
>             this.entityModel = entityModel;
>             this.model = (IModel<Collection&lt;T>>) model;
>             this.defaultProcessing = defaultProcessing;
>         }
>
>         /** {@inheritDoc} */
>         @Override
>         protected void onError(final AjaxRequestTarget target)
>         {
>                 throw new RuntimeException();
>         }
>
>         /** {@inheritDoc} */
>         @Override
>         protected void onSubmit(final AjaxRequestTarget target)
>         {
>             // code goes here
>         }
>     }*
>
> Please suggest me how to set the defaultProcessing to false in the above.
>
> thanks in advance
> WNU
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-set-defaultProcessing-for-AjaxFormSubmitBehavior-tp4656202.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Re: How to set defaultProcessing for AjaxFormSubmitBehavior

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Just override :

@Override
public boolean getDefaultProcessing()
{
 return defaultProcessing;
}


On Fri, Feb 8, 2013 at 11:11 AM, wicket_new_user <mu...@gmail.com>wrote:

> Hi,
> i'm having an issue where the form is getting submitted, when
> AjaxFormSubmitBehavior is being used.
>
> I see we can avoid the form submission (validation part) when we set
> defaultProcessing to false.
>
> Below is my snippet of code.
>
> *private final class SelectorUpdateBehavior extends AjaxFormSubmitBehavior
>     {
>         private static final long serialVersionUID = 1L;
>
>         private final IModel<T> entityModel;
>         private final IModel<Collection&lt;T>> model;
>         private final boolean defaultProcessing;
>
>         @SuppressWarnings("unchecked")
>         private SelectorUpdateBehavior(final IModel<? extends
> Collection<T>>
> model, final IModel<T> entityModel, final boolean defaultProcessing)
>         {
>             super("onchange");
>             this.entityModel = entityModel;
>             this.model = (IModel<Collection&lt;T>>) model;
>             this.defaultProcessing = defaultProcessing;
>         }
>
>         /** {@inheritDoc} */
>         @Override
>         protected void onError(final AjaxRequestTarget target)
>         {
>                 throw new RuntimeException();
>         }
>
>         /** {@inheritDoc} */
>         @Override
>         protected void onSubmit(final AjaxRequestTarget target)
>         {
>             // code goes here
>         }
>     }*
>
> Please suggest me how to set the defaultProcessing to false in the above.
>
> thanks in advance
> WNU
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-set-defaultProcessing-for-AjaxFormSubmitBehavior-tp4656202.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
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>