There is nothing about 'confirm' in this paste but without digging
into the code I'll assume it is just before the 'wcall' variable.
So it seems the result of IAjaxCallDecorator is wrapped in
wicketThrottler.throttle().

Another approach:
override AjaxFormSubmitBehavior#onComponentTag(Component, ComponentTag) method:
{
  super.onComponentTag(component, tag); // this will set the value
that you pasted
  String oldValue = tag.getAttribute('onclick');
  String newValue = "if (!confirm()) {" + oldValue + "}";
  tag.put("onclick", newValue);
}

On Tue, Apr 10, 2012 at 12:00 PM,  <swwa...@tsmc.com> wrote:
>
>
> Dear:
>
> The generated value of onclick is =>
>
> wicketThrottler.throttle( 'th107', 10000, function() { var
> wcall=wicketSubmitFormById('buttonForm92',
> '/portal/tool/cde5a792-9eaa-45c5-bd06-27b9aaa83719/?wicket:interface=ScormPlayer:32:buttonForm:quitButton::IBehaviorListener:2:-1',
>  'quitButton' ,null,null, function() {return Wicket.$$
> (this)&amp;&amp;Wicket.$$('buttonForm92')}.bind(this));});;
>
> Any way to achieve this requrement?
>
> Best Regards,
>
> Joan
>
>
>
> |------------------------------------->
> |            Martin Grigorov          |
> |            <mgrigo...@apache.org>   |
> |                                     |
> |                                     |
> |                                     |
> |            2012/04/10 下午 05:35    |
> |                                     |
> |                                     |
> |                Please respond to    |
> |             users@wicket.apache.org |
> |                                     |
> |------------------------------------->
>  >--------------------------------------------------------------------------------------------------------------------------------------------------|
>  |                                                                            
>                                                                       |
>  |                                                                            
>                                                                       |
>  |                                                                            
>                                                                     To|
>  |        users@wicket.apache.org                                             
>                                                                       |
>  |                                                                            
>                                                                     cc|
>  |                                                                            
>                                                                       |
>  |                                                                            
>                                                                Subject|
>  |        Re: Help. Is it possible show a alert before setThrottleDelay..??   
>                                                                       |
>  |                                                                            
>                                                                       |
>  |                                                                            
>                                                                       |
>  |                                                                            
>                                                                       |
>  |                                                                            
>                                                                       |
>  |                                                                            
>                                                                       |
>  >--------------------------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>
> Can you paste what is the generated value of 'onclick' attribute with
> the current code ?
>
> On Tue, Apr 10, 2012 at 11:31 AM,  <swwa...@tsmc.com> wrote:
>>
>>
>> Thanks for your reply..   But it's not worked.
>> I change the IAjaxCallDecorator to the following code..
>>
>>                       protected IAjaxCallDecorator getAjaxCallDecorator()
> {
>>                        return new AjaxPreprocessingCallDecorator
>> (super.getAjaxCallDecorator()) {
>>                        private static final long serialVersionUID = 1L;
>>
>>                            @Override
>>                            public CharSequence preDecorateScript
> (CharSequence
>> script) {
>>                                return "if(!confirm('continues?')) return
>> false;" + script;
>>                            }
>>                        };
>>                    }
>>
>> But.. the result is
>> 1. click a button.
>> 2. suspend 1 minute
>> 3. show a confirm message, and if yes, submit the form..
>>
>> But want I need is
>> 1. click a button and show a confirm message.
>> 2. suspend 1 minute
>> 3. submit the form..
>>
>>
>>
>>
>> Best Regards,
>>
>> BSID/ERP
>> Joan Wang 王琇緯
>>
>>
>>
>> |------------------------------------->
>> |            Martin Grigorov          |
>> |            <mgrigo...@apache.org>   |
>> |                                     |
>> |                                     |
>> |                                     |
>> |            2012/04/10 下午 05:23    |
>> |                                     |
>> |                                     |
>> |                Please respond to    |
>> |             users@wicket.apache.org |
>> |                                     |
>> |------------------------------------->
>>
>>--------------------------------------------------------------------------------------------------------------------------------------------------|
>
>>  |
> |
>>  |
> |
>>  |
> To|
>>  |        users@wicket.apache.org
> |
>>  |
> cc|
>>  |
> |
>>  |
> Subject|
>>  |        Re: Help. Is it possible show a alert before
> setThrottleDelay..??
> |
>>  |
> |
>>  |
> |
>>  |
> |
>>  |
> |
>>  |
> |
>>
>>--------------------------------------------------------------------------------------------------------------------------------------------------|
>
>>
>>
>>
>>
>> Hi,
>>
>> Your code looks OK.
>> You can add the confirm dialog with IAjaxCallDecorator.
>>
>> 2012/4/10  <swwa...@tsmc.com>:
>>>
>>> I am not familiar with wicket..  please help to give me suggestion for
>> How
>>> to implement this?
>>>
>>> 1. click a button and show a confirm message.
>>> 2. suspend 1 minute
>>> 3. submit the form..
>>>
>>>        public ActivityAjaxButton(final ButtonForm form, SessionBean
>>> sessionBean, String id, int seqRequest, String rootSrc) {
>>>                super(id, form);
>>>                this.form = form;
>>>                this.seqRequest = seqRequest;
>>>                this.rootSrc = rootSrc;
>>>                this.setModel(new Model(sessionBean));
>>>                add(new AjaxFormSubmitBehavior(form, "onclick") {
>>>
>>>                        private static final long serialVersionUID = 1L;
>>>                        protected void onSubmit(AjaxRequestTarget
> target){
>>>                                target.appendJavascript("alert('Sumibt
>>> Successfully')");
>>>                                ActivityAjaxButton.this.onSubmit(target,
>> form);
>>>                        }
>>>
>>>                        protected void onError(AjaxRequestTarget target){
>>>                                ActivityAjaxButton.this.onError(target,
>> form);
>>>                        }
>>>
>>>
>>>                        protected CharSequence getEventHandler(){
>>>                                return new AppendingStringBuffer
>>> (super.getEventHandler()).append("; return false;");
>>>                        }
>>>
>>>                        protected IAjaxCallDecorator getAjaxCallDecorator
>> ()     {
>>>
>>>                                return
>> ActivityAjaxButton.this.getAjaxCallDecorator
>>> ();
>>>                        }
>>>
>>>                        public CharSequence getCallbackUrl(){
>>>                                return Utils.generateUrl(this, null,
>> getComponent
>>> (), useRelativeUrls);
>>>                        }
>>>
>>>                }.setThrottleDelay(Duration..ONE_MINUTE));
>>>          .........
>>>
>>>        protected void onSubmit(AjaxRequestTarget target, Form form) {
>>>                SessionBean sessionBean = (SessionBean)getModelObject();
>>>                modelChanging();
>>>                doNavigate(sessionBean, seqRequest, target);
>>>                modelChanged();
>>>        }
>>>         ........
>>>
>>>        }
>>>
>>> Best Regards,
>>>
>>> Joan Wang
>>>
>>>
>>>
>>> Best Regards,
>>>
>>> BSID/ERP
>>> Joan Wang 王琇緯
>>>
>>>
>>
> ---------------------------------------------------------------------------
>>>                                                         TSMC PROPERTY
>>>  This email communication (and any attachments) is proprietary
>> information
>>>  for the sole use of its
>>>  intended recipient. Any unauthorized review, use or distribution by
>> anyone
>>>  other than the intended
>>>  recipient is strictly prohibited.  If you are not the intended
>> recipient,
>>>  please notify the sender by
>>>  replying to this email, and then delete this email and any copies of it
>>>  immediately. Thank you.
>>>
>>
> ---------------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>>
>>
> ---------------------------------------------------------------------------
>>                                                         TSMC PROPERTY
>>  This email communication (and any attachments) is proprietary
> information
>>  for the sole use of its
>>  intended recipient. Any unauthorized review, use or distribution by
> anyone
>>  other than the intended
>>  recipient is strictly prohibited.  If you are not the intended
> recipient,
>>  please notify the sender by
>>  replying to this email, and then delete this email and any copies of it
>>  immediately. Thank you.
>>
> ---------------------------------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
>
>  ---------------------------------------------------------------------------
>                                                         TSMC PROPERTY
>  This email communication (and any attachments) is proprietary information
>  for the sole use of its
>  intended recipient. Any unauthorized review, use or distribution by anyone
>  other than the intended
>  recipient is strictly prohibited.  If you are not the intended recipient,
>  please notify the sender by
>  replying to this email, and then delete this email and any copies of it
>  immediately. Thank you.
>  ---------------------------------------------------------------------------
>



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

Reply via email to