You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mite <mi...@gmail.com> on 2009/12/08 02:47:02 UTC

Select does not submit form on change

Hi

I am trying to attach an event to a select. The guys that worked before me
used this model.
http://wiki.apache.org/tapestry/Tapestry5SelectObject

I have written this code so far:

<form t:type="form">
<t:selectObject t:id="courses" list="courses" value="currentCourse"
labelField="literal:courseId" onChange="form.submit();"/>
<t:submit/>
</form>

void onSubmit() {
	System.out.println("Value changed!");
}

Whenever I change the value from the select nothing prints on the console.
If I press the submit button, I get output in the console.
I am stuck the whole night on this.
Thank you
-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26687467.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by sandeepraj singh <sa...@atosorigin.com>.
What was your way out mite.How did you get it working

But anyways, do you think writing a java script for submitting a select
should be the ideal way that it should be working?


Thanks
Sandeep


Mite wrote:
> 
> At last. This way works.
> 
> This is the second time you get me out of the mud. :) 
> Thank you
> 

-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26707889.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by Mite <mi...@gmail.com>.
At last. This way works.

This is the second time you get me out of the mud. :) 
Thank you
-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26697258.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 08 Dec 2009 09:18:59 -0200, Mite <mi...@gmail.com> escreveu:

> No, I just have the function:
>
> void onSubmit() {
>         System.out.println("Value changed!");
> }

Try using onSuccess() instead of onSubmit().

By the way, instead of relying on onchange="", use Prototype events:


<form t:type="form" t:id="form">
<t:selectObject t:id="courses" list="courses" value="currentCourse"
labelField="literal:courseId" id="select"/>
<t:submit/>
</form>

<script type="text/javascript">
	Event.observe('select', 'change', function() { $('form').submit(); } );
</script>


-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Select does not submit form on change

Posted by Inge Solvoll <in...@gmail.com>.
I will be more specific then.

What you need to do is:

- Use Firefox and Firebug (or some other request monitoring tool) to see
what happens when you select something in your select. Is any event trigered
in the browser. Is something sent to the server?

- Check on the server side if the page class is at all contacted. Set a
breakpoint in your onActivate method or something similar.

On Tue, Dec 8, 2009 at 12:18 PM, Mite <mi...@gmail.com> wrote:

>
> No, I just have the function:
>
> void onSubmit() {
>        System.out.println("Value changed!");
> }
>
> <t:selectObject t:id="courses" list="courses" value="currentCourse"
> labelField="literal:courseId" onChange="this.form.submit();"/>
>
> which prints to console when a submit is made, but it does not print
> anything when I change the value.
>
>
> Are you using some debug tool to verify if a request is sent to the server?
> Like firebug in firefox? Are you getting a javascript error when you select
> something?
>
>
> --
> View this message in context:
> http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692303.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Select does not submit form on change

Posted by Mite <mi...@gmail.com>.
No, I just have the function:

void onSubmit() { 
        System.out.println("Value changed!"); 
}

<t:selectObject t:id="courses" list="courses" value="currentCourse"
labelField="literal:courseId" onChange="this.form.submit();"/> 

which prints to console when a submit is made, but it does not print
anything when I change the value.


Are you using some debug tool to verify if a request is sent to the server?
Like firebug in firefox? Are you getting a javascript error when you select
something?


-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692303.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by Inge Solvoll <in...@gmail.com>.
You're not giving us very much information to work with here...

Are you using some debug tool to verify if a request is sent to the server?
Like firebug in firefox? Are you getting a javascript error when you select
something?

On Tue, Dec 8, 2009 at 11:58 AM, Mite <mi...@gmail.com> wrote:

>
> Thank you for the reply.
> It does not make any difference. Still the same result.
>
> This is really bad. Trying to get to work an event on a select for a whole
> day.
> It is so much easier with .NET or only JavaScript and HTML.
>
>
>
> Try
>
> this.form.submit()
>
> --
> View this message in context:
> http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692063.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

RE: Select does not submit form on change

Posted by "Newham, Cameron" <ca...@bl.uk>.
The only way I got this to work was via Javascript called from the
select to do the submit.



-----Original Message-----
From: Mite [mailto:mitemeister@gmail.com] 
Sent: 08 December 2009 10:58
To: users@tapestry.apache.org
Subject: Re: Select does not submit form on change


Thank you for the reply.
It does not make any difference. Still the same result.

This is really bad. Trying to get to work an event on a select for a
whole
day.
It is so much easier with .NET or only JavaScript and HTML. 



Try

this.form.submit()

-- 
View this message in context:
http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p2
6692063.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Select does not submit form on change

Posted by Mite <mi...@gmail.com>.
Thank you for the reply.
It does not make any difference. Still the same result.

This is really bad. Trying to get to work an event on a select for a whole
day.
It is so much easier with .NET or only JavaScript and HTML. 



Try

this.form.submit()

-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692063.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by Inge Solvoll <in...@gmail.com>.
Try

this.form.submit()

On Tue, Dec 8, 2009 at 2:47 AM, Mite <mi...@gmail.com> wrote:

>
> Hi
>
> I am trying to attach an event to a select. The guys that worked before me
> used this model.
> http://wiki.apache.org/tapestry/Tapestry5SelectObject
>
> I have written this code so far:
>
> <form t:type="form">
> <t:selectObject t:id="courses" list="courses" value="currentCourse"
> labelField="literal:courseId" onChange="form.submit();"/>
> <t:submit/>
> </form>
>
> void onSubmit() {
>        System.out.println("Value changed!");
> }
>
> Whenever I change the value from the select nothing prints on the console.
> If I press the submit button, I get output in the console.
> I am stuck the whole night on this.
> Thank you
> --
> View this message in context:
> http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26687467.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Select does not submit form on change

Posted by Inge Solvoll <in...@gmail.com>.
I solved this problem just a few weeks ago myself :) It is a very bad bug
that is very hard to track down, the only error is "submit is not a
function".

The solution is to assign an id to your submit button, like this: <t:submit
id="saveButton"/>. You should always do that anyway, it makes code clearer
and it is easier to test with tools like selenium.

On Wed, Dec 9, 2009 at 1:33 AM, Vangel V. Ajanovski <aj...@ii.edu.mk> wrote:

> Sorry, but there might be some problem with the mailing list, my message
> was considered as a SPAM and first the text was removed from the
> message, and the next time I got info that it was considered as SPAM.
>
> I am sending the message again.
>
> On 08.12.2009 02:47, Mite wrote:
> > I have written this code so far:
> >
> > <form t:type="form">
> > <t:selectObject t:id="courses" list="courses" value="currentCourse"
> > labelField="literal:courseId" onChange="form.submit();"/>
> > <t:submit/>
> > </form>
> >
>
> This issue is not really a problem of Tapestry, this is a Javascript
> browser implementation problem.
> In my code sample this works in IE 8, and it does not work in Firefox
> 3.6 or Opera 10
>
> Take the submit button out, and it will work with no problem.
>
> So, What exactly happens in for example Firefox is that when you add a
> Submit button, the Submit() function is overriden with the Submit button
> and it becomes a property.
> Now the form.submit is not the function for submitting any more, but in
> fact now it is the submit button itself.
>
> I think that I never ever had a need to use a button and a list for
> submitting at the same time, so I never saw this as a problem.
>
> But, the bad thing is that here Thiago's solution does not help - with
> it I get an
>    Event.observe is not a function
> And now it does not work even in IE.
>
>

Re: Select does not submit form on change

Posted by "Vangel V. Ajanovski" <aj...@ii.edu.mk>.
On 09.12.2009 01:33, Vangel V. Ajanovski wrote:
>
> But, the bad thing is that here Thiago's solution does not help - with
> it I get an
>     Event.observe is not a function
> And now it does not work even in IE.
>
>   
Now I am replying to myself ;)
Of course it doesn't work - prototype is not automatically bundled with
such a simple page - will have to do that manually.


Re: Select does not submit form on change

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 09 Dec 2009 16:10:44 -0200, Vangel V. Ajanovski <aj...@ii.edu.mk>  
escreveu:

> - t:id="my submit" - works

AFAIK, t:id can't have a space on it.

> - id="my submit" does not work

> Does this mean that theoretically a single component can have two id-s?
> One tapestry id, and another non-tapestry one?

Yes, and it has a purpose. When a component is put inside a Grid or Loop,  
it has one t:id, but each generated HTML tag a different id.
t:id is a Tapestry component id. id is the HTML id.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Select does not submit form on change

Posted by "Vangel V. Ajanovski" <aj...@ii.edu.mk>.
On 09.12.2009 11:24, sandeepraj singh wrote:
> Its because, when you do not assign t:id to a submit button, it assigns
> name="submit"
> which has a conflict with any other submit in your page(even through java
> Script)
>
> i got it working with t:id="My Submit"  then even on Change works.
>   
Huh :( I never thought about putting t: prefix on id.

- t:id="my submit" - works
- id="my submit" does not work

Does this mean that theoretically a single component can have two id-s?
One tapestry id, and another non-tapestry one?


Re: Select does not submit form on change

Posted by Inge Solvoll <in...@gmail.com>.
https://issues.apache.org/jira/browse/TAP5-947

On Wed, Dec 9, 2009 at 1:17 PM, sandeepraj singh <
sandeepraj.singh@atosorigin.com> wrote:

>
> Hi Inge,
> I am not able to raise the jira since i am sitting behind a firewall.
> Do you mind raising it?
>
> Thanks
> Sandeep
>
>
> Inge Solvoll-2 wrote:
> >
> > I think this should be a JIRA issue in T5. If you don't specify an id for
> > a
> > submit, T5 generates name="submit", which breaks form javascript. T5
> > should
> > generate a safe default name for submit component.
> >
> > On Wed, Dec 9, 2009 at 11:24 AM, sandeepraj singh <
> > sandeepraj.singh@atosorigin.com> wrote:
> >
> >>
> >> Hi,
> >>
> >> Its because, when you do not assign t:id to a submit button, it assigns
> >> name="submit"
> >> which has a conflict with any other submit in your page(even through
> java
> >> Script)
> >>
> >> i got it working with t:id="My Submit"  then even on Change works.
> >>
> >> This is such an irritating error that we have put it our development
> >> checklist to check that there is no submit button with name as submit.
> >>
> >> Thanks
> >> sandeep
> >>
> >>
> >> Mite wrote:
> >> >
> >> > I removed the submit button and it works indeed.
> >> > Thank you for the answer.
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26708037.html
> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26709309.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Select does not submit form on change

Posted by sandeepraj singh <sa...@atosorigin.com>.
Hi Inge,
I am not able to raise the jira since i am sitting behind a firewall.
Do you mind raising it?

Thanks
Sandeep


Inge Solvoll-2 wrote:
> 
> I think this should be a JIRA issue in T5. If you don't specify an id for
> a
> submit, T5 generates name="submit", which breaks form javascript. T5
> should
> generate a safe default name for submit component.
> 
> On Wed, Dec 9, 2009 at 11:24 AM, sandeepraj singh <
> sandeepraj.singh@atosorigin.com> wrote:
> 
>>
>> Hi,
>>
>> Its because, when you do not assign t:id to a submit button, it assigns
>> name="submit"
>> which has a conflict with any other submit in your page(even through java
>> Script)
>>
>> i got it working with t:id="My Submit"  then even on Change works.
>>
>> This is such an irritating error that we have put it our development
>> checklist to check that there is no submit button with name as submit.
>>
>> Thanks
>> sandeep
>>
>>
>> Mite wrote:
>> >
>> > I removed the submit button and it works indeed.
>> > Thank you for the answer.
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26708037.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26709309.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by Inge Solvoll <in...@gmail.com>.
I think this should be a JIRA issue in T5. If you don't specify an id for a
submit, T5 generates name="submit", which breaks form javascript. T5 should
generate a safe default name for submit component.

On Wed, Dec 9, 2009 at 11:24 AM, sandeepraj singh <
sandeepraj.singh@atosorigin.com> wrote:

>
> Hi,
>
> Its because, when you do not assign t:id to a submit button, it assigns
> name="submit"
> which has a conflict with any other submit in your page(even through java
> Script)
>
> i got it working with t:id="My Submit"  then even on Change works.
>
> This is such an irritating error that we have put it our development
> checklist to check that there is no submit button with name as submit.
>
> Thanks
> sandeep
>
>
> Mite wrote:
> >
> > I removed the submit button and it works indeed.
> > Thank you for the answer.
> >
>
> --
> View this message in context:
> http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26708037.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Select does not submit form on change

Posted by sandeepraj singh <sa...@atosorigin.com>.
Hi,

Its because, when you do not assign t:id to a submit button, it assigns
name="submit"
which has a conflict with any other submit in your page(even through java
Script)

i got it working with t:id="My Submit"  then even on Change works.

This is such an irritating error that we have put it our development
checklist to check that there is no submit button with name as submit.

Thanks
sandeep


Mite wrote:
> 
> I removed the submit button and it works indeed.
> Thank you for the answer.
> 

-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26708037.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by Mite <mi...@gmail.com>.
I removed the submit button and it works indeed.
Thank you for the answer.
-- 
View this message in context: http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26703632.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Select does not submit form on change

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 08 Dec 2009 22:33:40 -0200, Vangel V. Ajanovski <aj...@ii.edu.mk>  
escreveu:

> But, the bad thing is that here Thiago's solution does not help - with
> it I get an Event.observe is not a function
> And now it does not work even in IE.

This is a Prototype function, documented here:  
http://www.prototypejs.org/api/event/observe. If Prototype wasn't added  
automatically by some Tapestry component, you can easily add it by  
annotating your page class or component with  
@IncludeJavaScriptLibrary("${tapestry.scriptaculous}/prototype.js").

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Select does not submit form on change

Posted by "Vangel V. Ajanovski" <aj...@ii.edu.mk>.
Sorry, but there might be some problem with the mailing list, my message
was considered as a SPAM and first the text was removed from the
message, and the next time I got info that it was considered as SPAM.

I am sending the message again.

On 08.12.2009 02:47, Mite wrote:
> I have written this code so far:
>
> <form t:type="form">
> <t:selectObject t:id="courses" list="courses" value="currentCourse"
> labelField="literal:courseId" onChange="form.submit();"/>
> <t:submit/>
> </form>
>  

This issue is not really a problem of Tapestry, this is a Javascript
browser implementation problem.
In my code sample this works in IE 8, and it does not work in Firefox
3.6 or Opera 10

Take the submit button out, and it will work with no problem.

So, What exactly happens in for example Firefox is that when you add a
Submit button, the Submit() function is overriden with the Submit button
and it becomes a property.
Now the form.submit is not the function for submitting any more, but in
fact now it is the submit button itself.

I think that I never ever had a need to use a button and a list for
submitting at the same time, so I never saw this as a problem.

But, the bad thing is that here Thiago's solution does not help - with
it I get an
    Event.observe is not a function
And now it does not work even in IE.