You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nikolaos Konstantinou <nk...@upcom.eu> on 2007/10/15 10:05:38 UTC

Form submission fails only after the 1st time, T4.1.3 bug?

I am facing this strange behaviour if Tapestry 4.1.3:

I have a form, declared in the .page as:

  <component id="quoteForm" type="Form">
    <binding name="listener" value="listener:quoteSubmit"/>
    <binding name="delegate" value="beans.validationDelegate"/>
    <binding name="method" value='"get"'/>
    <binding name="success" value="listener:quoteSubmit"/>
  </component>

In the .xhtml file, I place a PropertySelection component (model and value
are ok).
  <component id="selectCountry" type="PropertySelection">
    <binding name="model" value="countrySelectionModel"/>
    <binding name="value" value="selectedCountryId"/>
  </component>

The problem is that I want to submit the form when the user changes the
value of the drop-down list.
Till Tapestry 3.0 -- as far as I'm aware of -- there was a
submitOnChange="true"  that worked fine.

How can this be done in Tapestry 4.1.*?
I tried writing
onchange="javascript:this.form.submit();" at the PropertySelection component


<select jwcid="selectCountry" onchange="javascript:this.form.submit();">

but it only works once(!). What I mean is that the first time the user
selects something, everything works, the form gets submitted and the page
gets refreshed.
When I try for the second time, I get a blank screen without any debug
message and sometimes (after small modifications) the "The connection to the
server was reset" message! Shouldn't Tapestry produce some kind of a
warning?

The listener code is

public IPage quoteSubmit(IRequestCycle cycle) {

        System.out.println("SelectedCountryId: " + getSelectedCountryId());

        System.out.println("nkons Debug check QUOTE_SUBMIT " +
getSelectedSubmitComponent());
        if ("QUOTE_SUBMIT".equals(getSelectedSubmitComponent())) {
....
.....
          return some_other_page;
       } else {
            this.setSelectedLocationId(null);
            return this;
        }

The application server is jboss 4.2.1
I would appreciate any ideas

Re: Form submission fails only after the 1st time, T4.1.3 bug?

Posted by Nikolaos Konstantinou <nk...@upcom.eu>.
Hello,

I managed to solve it. The problem was the line at the listener:
this.setSelectedLocationId(null);
that was setting the selectedLocation to null. Why I asked before was
because I was facing a behaviour without any produced messages, so I didn't
know where to begin. In the beginning of the listener I had a
System.out.println("SelectedCountryId: " + getSelectedCountryId());
that wasn't printing anything (not even a null exception).
I found the solution ad hoc after all but anyway, thanks for the quick reply

On 10/15/07, Patrick Klein <pa...@bi-so.de> wrote:
>
> Hello,
>
> "javascript:" is not needed, just
>     onChange="this.form.submit();"
>
> Regards,
>     Patrick
> > I am facing this strange behaviour if Tapestry 4.1.3:
> >
> > I have a form, declared in the .page as:
> >
> >   <component id="quoteForm" type="Form">
> >     <binding name="listener" value="listener:quoteSubmit"/>
> >     <binding name="delegate" value="beans.validationDelegate"/>
> >     <binding name="method" value='"get"'/>
> >     <binding name="success" value="listener:quoteSubmit"/>
> >   </component>
> >
> > In the .xhtml file, I place a PropertySelection component (model and
> value
> > are ok).
> >   <component id="selectCountry" type="PropertySelection">
> >     <binding name="model" value="countrySelectionModel"/>
> >     <binding name="value" value="selectedCountryId"/>
> >   </component>
> >
> > The problem is that I want to submit the form when the user changes the
> > value of the drop-down list.
> > Till Tapestry 3.0 -- as far as I'm aware of -- there was a
> > submitOnChange="true"  that worked fine.
> >
> > How can this be done in Tapestry 4.1.*?
> > I tried writing
> > onchange="javascript:this.form.submit();" at the PropertySelection
> component
> >
> >
> > <select jwcid="selectCountry" onchange="javascript:this.form.submit();">
> >
> > but it only works once(!). What I mean is that the first time the user
> > selects something, everything works, the form gets submitted and the
> page
> > gets refreshed.
> > When I try for the second time, I get a blank screen without any debug
> > message and sometimes (after small modifications) the "The connection to
> the
> > server was reset" message! Shouldn't Tapestry produce some kind of a
> > warning?
> >
> > The listener code is
> >
> > public IPage quoteSubmit(IRequestCycle cycle) {
> >
> >         System.out.println("SelectedCountryId: " +
> getSelectedCountryId());
> >
> >         System.out.println("nkons Debug check QUOTE_SUBMIT " +
> > getSelectedSubmitComponent());
> >         if ("QUOTE_SUBMIT".equals(getSelectedSubmitComponent())) {
> > ....
> > .....
> >           return some_other_page;
> >        } else {
> >             this.setSelectedLocationId(null);
> >             return this;
> >         }
> >
> > The application server is jboss 4.2.1
> > I would appreciate any ideas
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Nikolaos Konstantinou
PhD Student - Research Assistant
Homepage: http://www.cn.ntua.gr/~nkons

Re: Form submission fails only after the 1st time, T4.1.3 bug?

Posted by Patrick Klein <pa...@bi-so.de>.
Hello,

"javascript:" is not needed, just
    onChange="this.form.submit();"

Regards,
    Patrick
> I am facing this strange behaviour if Tapestry 4.1.3:
>
> I have a form, declared in the .page as:
>
>   <component id="quoteForm" type="Form">
>     <binding name="listener" value="listener:quoteSubmit"/>
>     <binding name="delegate" value="beans.validationDelegate"/>
>     <binding name="method" value='"get"'/>
>     <binding name="success" value="listener:quoteSubmit"/>
>   </component>
>
> In the .xhtml file, I place a PropertySelection component (model and value
> are ok).
>   <component id="selectCountry" type="PropertySelection">
>     <binding name="model" value="countrySelectionModel"/>
>     <binding name="value" value="selectedCountryId"/>
>   </component>
>
> The problem is that I want to submit the form when the user changes the
> value of the drop-down list.
> Till Tapestry 3.0 -- as far as I'm aware of -- there was a
> submitOnChange="true"  that worked fine.
>
> How can this be done in Tapestry 4.1.*?
> I tried writing
> onchange="javascript:this.form.submit();" at the PropertySelection component
>
>
> <select jwcid="selectCountry" onchange="javascript:this.form.submit();">
>
> but it only works once(!). What I mean is that the first time the user
> selects something, everything works, the form gets submitted and the page
> gets refreshed.
> When I try for the second time, I get a blank screen without any debug
> message and sometimes (after small modifications) the "The connection to the
> server was reset" message! Shouldn't Tapestry produce some kind of a
> warning?
>
> The listener code is
>
> public IPage quoteSubmit(IRequestCycle cycle) {
>
>         System.out.println("SelectedCountryId: " + getSelectedCountryId());
>
>         System.out.println("nkons Debug check QUOTE_SUBMIT " +
> getSelectedSubmitComponent());
>         if ("QUOTE_SUBMIT".equals(getSelectedSubmitComponent())) {
> ....
> .....
>           return some_other_page;
>        } else {
>             this.setSelectedLocationId(null);
>             return this;
>         }
>
> The application server is jboss 4.2.1
> I would appreciate any ideas
>
>   


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