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 <greatclever...@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_liu...@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
> or...@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_liu...@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
or...@facebook: http://www.facebook.com/group.php?gid=8159558294

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

Reply via email to