You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by cleverpig <gr...@gmail.com> on 2009/09/28 04:52:01 UTC

T5:how to call ajax callback function after form submit

hi,dear buddies!

I had a bean edit form to save my entity,and added div by using ajax
zone to show what's the submit response.
such as:
...
	<t:beaneditform t:id="scripEditForm"
		object="s"
		exclude="id"
		t:submitLabel="save"
		t:zone="response">
		</t:parameter>>
	</t:beaneditform>
	<div t:type="zone" t:id="response"></div>
...
after the form submit,response div would display this text:"ok,data
was saved!". it works normally.
but here is a tricky trap:after submit,the submit button still hold
enabled status,so user can reclick it to submit the same data to
server.

so i think there are some way to skip this trap:
1.don't use ajax zone,and return to redirect-after-response mode,this
edit form will post data and redirect to list page when data was
saved.
2.change the submit button's status to disabled and display a return
link in the response div.

the first way is unusually.
the second way would get some script to control button status,i can't
get way to handle this in beanEditForm,can you give me some help?

-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: www.cleverpig.name
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:how to call ajax callback function after form submit

Posted by cleverpig <gr...@gmail.com>.
hi,all!

i made a simple way just now:
in the page class,so event can make a script call when it returned to page div:
...
	@CommitAfter
	@OnEvent(component="scripEditForm",value="submit")
	public Object onSubmitEvent(){
		log.debug("onSubmitEvent...selectCatId="+this.s.getCatId());
		dao.save(s);
		return new JSONObject().put(
				"content", "Saved!<a href='./ListView'>return to lsit</a>" +
				"<script type='text/javascript'>disableSubmitButton();</script>");
	}
...
in the tml:
       <t:beaneditform t:id="scripEditForm"
               object="s"
               exclude="id"
               t:submitLabel="save"
               t:zone="response">
               </t:parameter>>
       </t:beaneditform>
       <div t:type="zone" t:id="response"></div>

	<!---begin:added script--->
	<script type='text/javascript'>
	function disableSubmitButton(){
		var submitButton=$$('.t-beaneditor-submit')[0];
		if (submitButton)
			submitButton.disabled=true;
	}
	</script>
	<!---end:added script--->

but is it a general way?

On Mon, Sep 28, 2009 at 10:52 AM, cleverpig <gr...@gmail.com> wrote:
> hi,dear buddies!
>
> I had a bean edit form to save my entity,and added div by using ajax
> zone to show what's the submit response.
> such as:
> ...
>        <t:beaneditform t:id="scripEditForm"
>                object="s"
>                exclude="id"
>                t:submitLabel="save"
>                t:zone="response">
>                </t:parameter>>
>        </t:beaneditform>
>        <div t:type="zone" t:id="response"></div>
> ...
> after the form submit,response div would display this text:"ok,data
> was saved!". it works normally.
> but here is a tricky trap:after submit,the submit button still hold
> enabled status,so user can reclick it to submit the same data to
> server.
>
> so i think there are some way to skip this trap:
> 1.don't use ajax zone,and return to redirect-after-response mode,this
> edit form will post data and redirect to list page when data was
> saved.
> 2.change the submit button's status to disabled and display a return
> link in the response div.
>
> the first way is unusually.
> the second way would get some script to control button status,i can't
> get way to handle this in beanEditForm,can you give me some help?
>
> --
> cleverpig(Dan)
> Location: Beijing
> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> Zipcode: 100031
> MSN: great_liudan@hotmail.com
> QQ: 149291732
> Skype: cleverpigatmatrix
> Facebook ID:cleverpig
> Blog: www.cleverpig.name
> Tags: del.icio.us/cleverpig
> Twitter: twitter.com/cleverpig
> 新浪微博: t.sina.com.cn/cleverpig
> Organization: www.beijing-open-party.org
> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>



-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: www.cleverpig.name
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:how to call ajax callback function after form submit

Posted by cleverpig <gr...@gmail.com>.
so i would find a generic way to call javascript function after ajax
reponse returned.
just like callback function in prototype's ajax.

2009/9/28 cleverpig <gr...@gmail.com>:
> On Mon, Sep 28, 2009 at 10:36 PM, Juan E. Maya <ma...@gmail.com> wrote:
>>
>> Look for Double submit handling on
>> http://www.laliluna.de/tapestry-webframework-evaluation-test.html
>> That's is probably what u need then
>
> oh,i'd saw it..but it used submit id to prevent user from double submit..
> and my question is not double submit,only is a re-submit..
> sorry,let me make more clear:
> double submit would happed before response page returned after form
> was submitted.
> my re-submit would happed after  response page was rendered,this time
> user counld re-click submit without modify anything,so that server
> will get 2 same data submit and save 2 same data(primary key value is
> different) in the database.
>>
>> On Mon, Sep 28, 2009 at 3:32 PM, cleverpig <gr...@gmail.com> wrote:
>> > hi,Juan!
>> >
>> > thank for your reply! i saw the mixin you finger out. :)
>> > but i will find a generic way to protect user from resubmit the data
>> > in next turn,just not double click in one time.
>> >
>> > 2009/9/28 Juan E. Maya <ma...@gmail.com>:
>> >> Jumpstart has Mixin to avoud double click problems.
>> >> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1
>> >>
>> >> Also Sebastian sent on the past days a solution that doesn't use Javascript
>> >>
>> >> On Mon, Sep 28, 2009 at 4:52 AM, cleverpig <gr...@gmail.com> wrote:
>> >>> hi,dear buddies!
>> >>>
>> >>> I had a bean edit form to save my entity,and added div by using ajax
>> >>> zone to show what's the submit response.
>> >>> such as:
>> >>> ...
>> >>>        <t:beaneditform t:id="scripEditForm"
>> >>>                object="s"
>> >>>                exclude="id"
>> >>>                t:submitLabel="save"
>> >>>                t:zone="response">
>> >>>                </t:parameter>>
>> >>>        </t:beaneditform>
>> >>>        <div t:type="zone" t:id="response"></div>
>> >>> ...
>> >>> after the form submit,response div would display this text:"ok,data
>> >>> was saved!". it works normally.
>> >>> but here is a tricky trap:after submit,the submit button still hold
>> >>> enabled status,so user can reclick it to submit the same data to
>> >>> server.
>> >>>
>> >>> so i think there are some way to skip this trap:
>> >>> 1.don't use ajax zone,and return to redirect-after-response mode,this
>> >>> edit form will post data and redirect to list page when data was
>> >>> saved.
>> >>> 2.change the submit button's status to disabled and display a return
>> >>> link in the response div.
>> >>>
>> >>> the first way is unusually.
>> >>> the second way would get some script to control button status,i can't
>> >>> get way to handle this in beanEditForm,can you give me some help?
>> >>>
>> >>> --
>> >>> cleverpig(Dan)
>> >>> Location: Beijing
>> >>> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
>> >>> Zipcode: 100031
>> >>> MSN: great_liudan@hotmail.com
>> >>> QQ: 149291732
>> >>> Skype: cleverpigatmatrix
>> >>> Facebook ID:cleverpig
>> >>> Blog: www.cleverpig.name
>> >>> Tags: del.icio.us/cleverpig
>> >>> Twitter: twitter.com/cleverpig
>> >>> 新浪微博: t.sina.com.cn/cleverpig
>> >>> Organization: www.beijing-open-party.org
>> >>> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >>> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>>
>> >>>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > cleverpig(Dan)
>> > Location: Beijing
>> > Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
>> > Zipcode: 100031
>> > MSN: great_liudan@hotmail.com
>> > QQ: 149291732
>> > Skype: cleverpigatmatrix
>> > Facebook ID:cleverpig
>> > Blog: www.cleverpig.name
>> > Tags: del.icio.us/cleverpig
>> > Twitter: twitter.com/cleverpig
>> > 新浪微博: t.sina.com.cn/cleverpig
>> > Organization: www.beijing-open-party.org
>> > Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
>
> --
> cleverpig(Dan)
> Location: Beijing
> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> Zipcode: 100031
> MSN: great_liudan@hotmail.com
> QQ: 149291732
> Skype: cleverpigatmatrix
> Facebook ID:cleverpig
> Blog: www.cleverpig.name
> Tags: del.icio.us/cleverpig
> Twitter: twitter.com/cleverpig
> 新浪微博: t.sina.com.cn/cleverpig
> Organization: www.beijing-open-party.org
> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>



-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: www.cleverpig.name
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:how to call ajax callback function after form submit

Posted by cleverpig <gr...@gmail.com>.
On Mon, Sep 28, 2009 at 10:36 PM, Juan E. Maya <ma...@gmail.com> wrote:
>
> Look for Double submit handling on
> http://www.laliluna.de/tapestry-webframework-evaluation-test.html
> That's is probably what u need then

oh,i'd saw it..but it used submit id to prevent user from double submit..
and my question is not double submit,only is a re-submit..
sorry,let me make more clear:
double submit would happed before response page returned after form
was submitted.
my re-submit would happed after  response page was rendered,this time
user counld re-click submit without modify anything,so that server
will get 2 same data submit and save 2 same data(primary key value is
different) in the database.
>
> On Mon, Sep 28, 2009 at 3:32 PM, cleverpig <gr...@gmail.com> wrote:
> > hi,Juan!
> >
> > thank for your reply! i saw the mixin you finger out. :)
> > but i will find a generic way to protect user from resubmit the data
> > in next turn,just not double click in one time.
> >
> > 2009/9/28 Juan E. Maya <ma...@gmail.com>:
> >> Jumpstart has Mixin to avoud double click problems.
> >> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1
> >>
> >> Also Sebastian sent on the past days a solution that doesn't use Javascript
> >>
> >> On Mon, Sep 28, 2009 at 4:52 AM, cleverpig <gr...@gmail.com> wrote:
> >>> hi,dear buddies!
> >>>
> >>> I had a bean edit form to save my entity,and added div by using ajax
> >>> zone to show what's the submit response.
> >>> such as:
> >>> ...
> >>>        <t:beaneditform t:id="scripEditForm"
> >>>                object="s"
> >>>                exclude="id"
> >>>                t:submitLabel="save"
> >>>                t:zone="response">
> >>>                </t:parameter>>
> >>>        </t:beaneditform>
> >>>        <div t:type="zone" t:id="response"></div>
> >>> ...
> >>> after the form submit,response div would display this text:"ok,data
> >>> was saved!". it works normally.
> >>> but here is a tricky trap:after submit,the submit button still hold
> >>> enabled status,so user can reclick it to submit the same data to
> >>> server.
> >>>
> >>> so i think there are some way to skip this trap:
> >>> 1.don't use ajax zone,and return to redirect-after-response mode,this
> >>> edit form will post data and redirect to list page when data was
> >>> saved.
> >>> 2.change the submit button's status to disabled and display a return
> >>> link in the response div.
> >>>
> >>> the first way is unusually.
> >>> the second way would get some script to control button status,i can't
> >>> get way to handle this in beanEditForm,can you give me some help?
> >>>
> >>> --
> >>> cleverpig(Dan)
> >>> Location: Beijing
> >>> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> >>> Zipcode: 100031
> >>> MSN: great_liudan@hotmail.com
> >>> QQ: 149291732
> >>> Skype: cleverpigatmatrix
> >>> Facebook ID:cleverpig
> >>> Blog: www.cleverpig.name
> >>> Tags: del.icio.us/cleverpig
> >>> Twitter: twitter.com/cleverpig
> >>> 新浪微博: t.sina.com.cn/cleverpig
> >>> Organization: www.beijing-open-party.org
> >>> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> >
> > --
> > cleverpig(Dan)
> > Location: Beijing
> > Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> > Zipcode: 100031
> > MSN: great_liudan@hotmail.com
> > QQ: 149291732
> > Skype: cleverpigatmatrix
> > Facebook ID:cleverpig
> > Blog: www.cleverpig.name
> > Tags: del.icio.us/cleverpig
> > Twitter: twitter.com/cleverpig
> > 新浪微博: t.sina.com.cn/cleverpig
> > Organization: www.beijing-open-party.org
> > Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



--
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: www.cleverpig.name
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:how to call ajax callback function after form submit

Posted by "Juan E. Maya" <ma...@gmail.com>.
Look for Double submit handling on
http://www.laliluna.de/tapestry-webframework-evaluation-test.html
That's is probably what u need then

On Mon, Sep 28, 2009 at 3:32 PM, cleverpig <gr...@gmail.com> wrote:
> hi,Juan!
>
> thank for your reply! i saw the mixin you finger out. :)
> but i will find a generic way to protect user from resubmit the data
> in next turn,just not double click in one time.
>
> 2009/9/28 Juan E. Maya <ma...@gmail.com>:
>> Jumpstart has Mixin to avoud double click problems.
>> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1
>>
>> Also Sebastian sent on the past days a solution that doesn't use Javascript
>>
>> On Mon, Sep 28, 2009 at 4:52 AM, cleverpig <gr...@gmail.com> wrote:
>>> hi,dear buddies!
>>>
>>> I had a bean edit form to save my entity,and added div by using ajax
>>> zone to show what's the submit response.
>>> such as:
>>> ...
>>>        <t:beaneditform t:id="scripEditForm"
>>>                object="s"
>>>                exclude="id"
>>>                t:submitLabel="save"
>>>                t:zone="response">
>>>                </t:parameter>>
>>>        </t:beaneditform>
>>>        <div t:type="zone" t:id="response"></div>
>>> ...
>>> after the form submit,response div would display this text:"ok,data
>>> was saved!". it works normally.
>>> but here is a tricky trap:after submit,the submit button still hold
>>> enabled status,so user can reclick it to submit the same data to
>>> server.
>>>
>>> so i think there are some way to skip this trap:
>>> 1.don't use ajax zone,and return to redirect-after-response mode,this
>>> edit form will post data and redirect to list page when data was
>>> saved.
>>> 2.change the submit button's status to disabled and display a return
>>> link in the response div.
>>>
>>> the first way is unusually.
>>> the second way would get some script to control button status,i can't
>>> get way to handle this in beanEditForm,can you give me some help?
>>>
>>> --
>>> cleverpig(Dan)
>>> Location: Beijing
>>> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
>>> Zipcode: 100031
>>> MSN: great_liudan@hotmail.com
>>> QQ: 149291732
>>> Skype: cleverpigatmatrix
>>> Facebook ID:cleverpig
>>> Blog: www.cleverpig.name
>>> Tags: del.icio.us/cleverpig
>>> Twitter: twitter.com/cleverpig
>>> 新浪微博: t.sina.com.cn/cleverpig
>>> Organization: www.beijing-open-party.org
>>> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> cleverpig(Dan)
> Location: Beijing
> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> Zipcode: 100031
> MSN: great_liudan@hotmail.com
> QQ: 149291732
> Skype: cleverpigatmatrix
> Facebook ID:cleverpig
> Blog: www.cleverpig.name
> Tags: del.icio.us/cleverpig
> Twitter: twitter.com/cleverpig
> 新浪微博: t.sina.com.cn/cleverpig
> Organization: www.beijing-open-party.org
> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:how to call ajax callback function after form submit

Posted by cleverpig <gr...@gmail.com>.
hi,Juan!

thank for your reply! i saw the mixin you finger out. :)
but i will find a generic way to protect user from resubmit the data
in next turn,just not double click in one time.

2009/9/28 Juan E. Maya <ma...@gmail.com>:
> Jumpstart has Mixin to avoud double click problems.
> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1
>
> Also Sebastian sent on the past days a solution that doesn't use Javascript
>
> On Mon, Sep 28, 2009 at 4:52 AM, cleverpig <gr...@gmail.com> wrote:
>> hi,dear buddies!
>>
>> I had a bean edit form to save my entity,and added div by using ajax
>> zone to show what's the submit response.
>> such as:
>> ...
>>        <t:beaneditform t:id="scripEditForm"
>>                object="s"
>>                exclude="id"
>>                t:submitLabel="save"
>>                t:zone="response">
>>                </t:parameter>>
>>        </t:beaneditform>
>>        <div t:type="zone" t:id="response"></div>
>> ...
>> after the form submit,response div would display this text:"ok,data
>> was saved!". it works normally.
>> but here is a tricky trap:after submit,the submit button still hold
>> enabled status,so user can reclick it to submit the same data to
>> server.
>>
>> so i think there are some way to skip this trap:
>> 1.don't use ajax zone,and return to redirect-after-response mode,this
>> edit form will post data and redirect to list page when data was
>> saved.
>> 2.change the submit button's status to disabled and display a return
>> link in the response div.
>>
>> the first way is unusually.
>> the second way would get some script to control button status,i can't
>> get way to handle this in beanEditForm,can you give me some help?
>>
>> --
>> cleverpig(Dan)
>> Location: Beijing
>> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
>> Zipcode: 100031
>> MSN: great_liudan@hotmail.com
>> QQ: 149291732
>> Skype: cleverpigatmatrix
>> Facebook ID:cleverpig
>> Blog: www.cleverpig.name
>> Tags: del.icio.us/cleverpig
>> Twitter: twitter.com/cleverpig
>> 新浪微博: t.sina.com.cn/cleverpig
>> Organization: www.beijing-open-party.org
>> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: www.cleverpig.name
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:how to call ajax callback function after form submit

Posted by "Juan E. Maya" <ma...@gmail.com>.
Jumpstart has Mixin to avoud double click problems.
http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1

Also Sebastian sent on the past days a solution that doesn't use Javascript

On Mon, Sep 28, 2009 at 4:52 AM, cleverpig <gr...@gmail.com> wrote:
> hi,dear buddies!
>
> I had a bean edit form to save my entity,and added div by using ajax
> zone to show what's the submit response.
> such as:
> ...
>        <t:beaneditform t:id="scripEditForm"
>                object="s"
>                exclude="id"
>                t:submitLabel="save"
>                t:zone="response">
>                </t:parameter>>
>        </t:beaneditform>
>        <div t:type="zone" t:id="response"></div>
> ...
> after the form submit,response div would display this text:"ok,data
> was saved!". it works normally.
> but here is a tricky trap:after submit,the submit button still hold
> enabled status,so user can reclick it to submit the same data to
> server.
>
> so i think there are some way to skip this trap:
> 1.don't use ajax zone,and return to redirect-after-response mode,this
> edit form will post data and redirect to list page when data was
> saved.
> 2.change the submit button's status to disabled and display a return
> link in the response div.
>
> the first way is unusually.
> the second way would get some script to control button status,i can't
> get way to handle this in beanEditForm,can you give me some help?
>
> --
> cleverpig(Dan)
> Location: Beijing
> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> Zipcode: 100031
> MSN: great_liudan@hotmail.com
> QQ: 149291732
> Skype: cleverpigatmatrix
> Facebook ID:cleverpig
> Blog: www.cleverpig.name
> Tags: del.icio.us/cleverpig
> Twitter: twitter.com/cleverpig
> 新浪微博: t.sina.com.cn/cleverpig
> Organization: www.beijing-open-party.org
> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org