I've got a question along these lines.  I have an AjaxSubmitButton on a
ModalWindow, and I'd like <CR> and <ESC> to trigger the expected behaviors.
Any suggestions on wiring this up?  My first instinct is to add a behavior
to the form, or perhaps the encapsulating Page...

On 2/20/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:

i wouldnt disable default form processing. just leave form.onsubmit()
empty and put all that logic into buttons

-igor


On 2/20/07, Charlie Dobbie <[EMAIL PROTECTED]> wrote:
>
> Hi Igor,
>
> Yes, I saw your post on wicket-dev*.  It would certainly make more
> sense that way around in the code I'm currently playing with!
>
> Ah, yes - I can disable default form processing on the button and call
> the form's onSubmit logic directly - I'll give that a try.  (Although
> that would mean I don't even get the form's default onError logic -
> which is an even bigger annoyance!  I'll have a go...)
>
> Yes, AjaxSubmitButton has an onError method, but Button does not.  I'm
> guessing this is by design!  As a very new user of the framework, I'm
> never sure why some things are the way they are.
>
> Charlie.
>
>
> * In case anyone's interested,
> http://www.nabble.com/form.onsubmit-vs-button.onsubmit-tf1977859.html
>
>
>
> On 2/20/07, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > yes, that is also something i do not like. i think form.submit()
> should be
> > called before the button.onsubmit()
> >
> > what i tend to do is to leave form.submit() unused and put all the
> logic
> > into button.onsubmit()
> >
> > what do you mean no onerror method? ajaxsubmitbutton should have one
> afaik.
> >
> > -igor
> >
> >
> >
> > On 2/20/07, Charlie Dobbie < [EMAIL PROTECTED]> wrote:
> > >
> > > Hi Igor,
> > >
> > > Thanks, that's very reassuring!  I'm having a bit of fun with
> > > Button.onSubmit being called before Form.onSubmit and I'm still not
> > > entirely sure what to do about the lack of an onError method, but
> I'm
> > > on the right track now.
> > >
> > > Charlie.
> > >
> > >
> > >
> > > On 2/15/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > yes there is a better way. you should handle it inside the
> button's
> > onsubmit
> > > > not inside the form's onsubmit.
> > > >
> > > > that way:
> > > >
> > > > add(new Button() { onsubmit() { setresponsepage(..)
> isvisible(){...}});
> > > > add(new AjaxSubmitButton(onsubmit(target) {
> > > > window.close (target); } onerror(){...} isvisible() {..} }
> > > >
> > > > -igor
> > > >
> > > >
> > > >
> > > > On 2/15/07, Charlie Dobbie <[EMAIL PROTECTED] > wrote:
> > > > >
> > > > > Hi Igor,
> > > > >
> > > > > The processing of the submitted data is handled in the same way,
> but
> > > > > the following page navigation must be different.  If in a
> standard
> > > > > request, I'll need to setResponsePage() to the next page, but an
> AJAX
> > > > > request will just want to ModalWindow.close().  Error handling
> is also
> > > > > going to differ.
> > > > >
> > > > > I wonder if I've got entirely the wrong end of the stick
> here?  I'm
> > > > > afraid it's quite possible that I've misunderstood something
> > > > > fundamental in Wicket's form processing or page navigation!
> > > > >
> > > > > Is there a more suitable place to handle page navigation than
> the
> > > > > Form's onSubmit/onError methods, or even an entirely better way
> of
> > > > > doing things?
> > > > >
> > > > > Cheers,
> > > > > Charlie.
> > > > >
> > > > >
> > > > >
> > > > > On 2/14/07, Igor Vaynberg < [EMAIL PROTECTED] > wrote:
> > > > > > i thought you wanted to handle it the same way so why do you
> need to
> > > > know if
> > > > > > the processing is ajax or regular request?
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 2/14/07, Charlie Dobbie < [EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > Hi all,
> > > > > > >
> > > > > > > In my Databinder-using application I have the requirement to
>
> > > > > > > create/edit entities both within a standard request cycle,
> and via
> > > > > > > AJAX inside a Modal Window.  In the interests of not
> duplicating
> > code,
> > > > > > > I would like to drive both these processes from the same
> Form
> > object,
> > > > > > > passing a boolean from the page to tell the Panel containing
> the
> > Form
> > > > > > > whether it's submitting normally or via AJAX.
> > > > > > >
> > > > > > > I have run into the following problem:
> > > > > > >
> > > > > > > The AJAX submission is via an AjaxSubmitButton.  This
> Component
> > calls
> > > > > > > the Form's onSubmit/onError methods before calling its own
> > methods.
> > > > > > > This means I cannot include any code specific to one method
> of
> > > > > > > submission in the Form's onSubmit/onError methods.
> > > > > > >
> > > > > > > Because of this, for a standard submission I use a Button
> with
> > > > > > > defaultFormProcessing set to false and an overridden
> onSubmit
> > method.
> > > > > > > But the Button has no onError method, so I cannot provide
> any
> > > > > > > standard-submission-specific error-handling code if the same
> > object is
> > > > > > > to handle an AJAX submission.
> > > > > > >
> > > > > > > Does anyone have any suggestions on how to get around this?
> > > > > > >
> > > > > > > At the moment I'm attempting to step around the issue by
> > duplicating
> > > > > > > all submission-processing code the page via an anonymous
> subclass
> > of
> > > > > > > the Panel/Form object, but I would appreciate a better
> solution if
> > > > > > > anyone knows of one!
> > > > > > >
> > > > > > > Cheers,
> > > > > > > Charlie.
>
>
> -------------------------------------------------------------------------
> 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


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to