I don't mean to bump this, but was not quickstart not good enough to show the
problem?  If necessary, I can take another stab at it to make it more
useful.

Chuck


ChuckDeal wrote:
> 
> Here is a test case the shows the problem.  I have two identical pages. 
> The only difference is that one page has the submit button contained by
> the form in the second page it is outside of the Form.
> 
>  http://www.nabble.com/file/5295/quickstart-ajaxbutton.zip
> quickstart-ajaxbutton.zip  (this contains everything except for the lib
> folder and uses 1.3-incubating-SNAPSHOT)
> 
> 
> ChuckDeal wrote:
>> 
>> The AjaxSubmitButton specifically says that it does NOT have to be
>> attached to a form; from the javadoc
>> 
>>  * A button that submits the form via ajax. Since this button takes the
>> form as
>>  * a constructor argument it does not need to be added to it unlike the
>>  * [EMAIL PROTECTED] Button} component.
>> 
>> However, in practice, this is not the case.  I believe it is associated
>> with the change (1.2-SNAPSHOT -> 1.3-SNAPSHOT) to extend from Button.  
>> 
>> What goes wrong?  The exception says something to the effect of "Could
>> not find Form parent for [the button component]" (see the full stacktrace
>> in my original message way down below); when debugging, it calls the
>> getForm() method of my button which instead of returning the Form that
>> was supplied to the Constructor, calls findParent()
>> 
>> As for the test case, I'll see if I can put something together.
>> 
>> Chuck
>> 
>> 
>> Johan Compagner wrote:
>>> 
>>> a button should be in a form (one of its parents)
>>> or a button should get the form through its constructor.
>>> 
>>> So what goes wrong exactly?
>>> Can you have a small test case?
>>> 
>>> johan
>>> 
>>> 
>>> On 12/18/06, ChuckDeal <[EMAIL PROTECTED]> wrote:
>>>>
>>>>
>>>> It gets there fine, its this line:
>>>>
>>>> if (submit.getForm() == Form.this
>>>>
>>>> that is the problem.  submit (which is the button) does not belong to a
>>>> Form, it is supposed to contain a reference to a Form instead.  SInce
>>>> it
>>>> can't find a Form object for the button it throws an  exception
>>>>
>>>> throw new WicketRuntimeException("Could not find Form parent for " +
>>>> this);
>>>>
>>>> Thus killing the execution.
>>>>
>>>> To Igor:
>>>> It didn't make a difference when I renamed (wicket:id) the button from
>>>> "submit" to "submitButton".
>>>>
>>>> Chuck
>>>>
>>>>
>>>> Johan Compagner wrote:
>>>> >
>>>> > It should work AjaxSubmitButton is a IFormSubmittingComponent
>>>> component
>>>> so
>>>> > this code:
>>>> >
>>>> >         IFormSubmittingComponent submit =
>>>> > (IFormSubmittingComponent)getPage().visitChildren(
>>>> >                 IFormSubmittingComponent.class, new IVisitor()
>>>> >                 {
>>>> >                     public Object component(final Component
>>>> component)
>>>> >                     {
>>>> >                         // Get button
>>>> >                         final IFormSubmittingComponent submit =
>>>> > (IFormSubmittingComponent)component;
>>>> >
>>>> >                         // Check for button-name or
>>>> button-name.xrequest
>>>> > string
>>>> >                         if (submit.getForm() == Form.this
>>>> >                                 && (getRequest().getParameter(
>>>> > submit.getInputName()) != null || getRequest()
>>>> >
>>>> > .getParameter(submit.getInputName()
>>>> > + ".x") != null))
>>>> >
>>>> > should find the ajax button no matter if it is in the page or not
>>>> > (this is 1.3 code but as far as i know this isn't really changed)
>>>> >
>>>> > Frank are you reading with us? I believe you worked on this.
>>>> >
>>>> > johan
>>>> >
>>>> >
>>>> > On 12/13/06, ChuckDeal <[EMAIL PROTECTED]> wrote:
>>>> >>
>>>> >>
>>>> >> I have a Page that has a Form with some select boxes in it and,
>>>> outside
>>>> >> the
>>>> >> Form, I have three buttons (submit[AjaxSubmitButton],
>>>> reset[AjaxLink],
>>>> >> cancel[AjaxLink]).
>>>> >>
>>>> >> In Wicket 1.2.3  (Actually, I have been using the latest
>>>> 1.2-SNAPSHOT
>>>> >> releases) The submit button works as advertised and submits the
>>>> page.
>>>> >>
>>>> >> In 1.3-incubating-SNAPSHOT (latest as of 13DEC2006 7am EST), the
>>>> page
>>>> >> fails
>>>> >> with the following exception:
>>>> >>
>>>> >> wicket.WicketRuntimeException: Could not find Form parent for
>>>> >> [MarkupContainer [Component id = submit, page =
>>>> >> com.csc.aims.issuetracker.wicket.TestSelectionPage, path =
>>>> >> 0:submit.TestSelectionPage$7, isVisible = true, isVersioned =
>>>> false]]
>>>> >>         at wicket.markup.html.form.FormComponent.getForm(
>>>> >> FormComponent.java:409)
>>>> >>         at wicket.markup.html.form.Form$5.component(Form.java:633)
>>>> >>         at wicket.MarkupContainer.visitChildren(MarkupContainer.java
>>>> :749)
>>>> >>         at
>>>> wicket.markup.html.form.Form.findSubmittingButton(Form.java
>>>> >> :624)
>>>> >>         at
>>>> wicket.markup.html.form.Form.onFormSubmitted(Form.java:333)
>>>> >>         at
>>>> >> wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
>>>> >> AjaxFormSubmitBehavior.java:87)
>>>> >>         at
>>>> wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java
>>>> >> :165)
>>>> >>         at
>>>> >> wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
>>>> >> AbstractDefaultAjaxBehavior.java:225)
>>>> >>         at
>>>> >>
>>>> >>
>>>> wicket.request.target.component.listener.BehaviorRequestTarget.processEvents
>>>> >> (BehaviorRequestTarget.java:98)
>>>> >>         at
>>>> >> wicket.request.compound.DefaultEventProcessorStrategy.processEvents(
>>>> >> DefaultEventProcessorStrategy.java:64)
>>>> >>         at
>>>> >>
>>>> >>
>>>> wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents
>>>> >> (AbstractCompoundRequestCycleProcessor.java:56)
>>>> >>         at
>>>> >> wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java
>>>> >> :912)
>>>> >>         at wicket.RequestCycle.processEventsAndRespond(
>>>> RequestCycle.java
>>>> >> :950)
>>>> >>         at wicket.RequestCycle.step(RequestCycle.java:1026)
>>>> >>         at wicket.RequestCycle.steps(RequestCycle.java:1100)
>>>> >>         at wicket.RequestCycle.request(RequestCycle.java:454)
>>>> >>         at wicket.protocol.http.WicketFilter.doGet(WicketFilter.java
>>>> :243)
>>>> >>         at
>>>> wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java
>>>> >> :122)
>>>> >>
>>>> >> After consulting the Migration Wiki Page
>>>> >> (http://cwiki.apache.org/WICKET/migrate-13.html) it shows that both
>>>> >> AjaxSubmitButton and AjaxSubmitLink have changed to extend Button.
>>>> >> (Actually, I checked AjaxSubmitLink and it does NOT extend
>>>> >> button...).  But
>>>> >> according to the javadoc for AjaxSubmitButton, since you pass a form
>>>> to
>>>> >> the
>>>> >> constructor, you don't need to add the component to a Form object. 
>>>> In
>>>> >> practice this was not true.  Once I added the button to the form, it
>>>> >> worked
>>>> >> as advertised.
>>>> >>
>>>> >> I'm guessing the change was necessary as a result of the hierarchy
>>>> change
>>>> >> of
>>>> >> AjaxSubmitButton, but maybe the Form arg is no longer needed since
>>>> you
>>>> >> must
>>>> >> add it to the Form object?
>>>> >>
>>>> >> Chuck
>>>> >> --
>>>> >> View this message in context:
>>>> >>
>>>> http://www.nabble.com/AjaxSubmitButton-and-not-adding-it-to-a-Form-tf2815470.html#a7857386
>>>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>> >>
>>>> >>
>>>> >>
>>>> -------------------------------------------------------------------------
>>>> >> 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
>>>> >
>>>> >
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/AjaxSubmitButton-and-not-adding-it-to-a-Form-tf2815470.html#a7930588
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -------------------------------------------------------------------------
>>>> 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
>>> 
>>> 
>> 
>> 
> 

-- 
View this message in context: 
http://www.nabble.com/AjaxSubmitButton-and-not-adding-it-to-a-Form-tf2815470.html#a8435671
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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

Reply via email to