You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by LiborGMC <l....@gmc.net> on 2010/03/30 14:26:35 UTC

submit form on Safari and Opera doesn't work

Hi,
thanks to issue with IE8 
http://old.nabble.com/Error-in-tapestry.js-in-IE-8-ts27714386.html#a27904924
http://old.nabble.com/Error-in-tapestry.js-in-IE-8-ts27714386.html#a27904924 
I removed all mixins and checkbox groups and I replaced them with simple
Javascript. But I struggling with strange problem on Opera 9.6 and Safari
4.0.4. I'm not able submit form by Javascript on these browsers. 
I've tried all well known possibilities like:
document.forms['paTableForm'].submit();
document.forms[0].submit();
document.paTableForm.submit();

I've even created submit button and tried to fire click on it : 
document.getElementById('submitTable').click();

On IE8 , Firefox 3 and Chrome it works in every way. But in Opera and Safari
I'm not able to do so. Did anybody solve this issue? Can anybody help?

Libor
-- 
View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28081757.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: submit form on Safari and Opera doesn't work

Posted by LiborGMC <l....@gmc.net>.
Link has been removed again. So another attempt:
&lt;a t:type="actionLink" t:id="handleAction"
onclick="submitForm();">Submit&lt;/a>
-- 
View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28116039.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: submit form on Safari and Opera doesn't work

Posted by LiborGMC <l....@gmc.net>.
Link has been removed again. So another attempt:
&lt;a t:type="actionLink" t:id="handleAction"
onclick="submitForm();">Submit&lt;/a>
-- 
View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28116037.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: submit form on Safari and Opera doesn't work

Posted by LiborGMC <l....@gmc.net>.

You're complicating your implementation beyond needed. What you're trying  
is to do two requests in sequence: one to submit the form, other to handle  
an event. This is very error-prone, as it relies on the ordering of the  
arrival of the. Just use a LinkSubmit: the form will be submitted and the  
selected event will be triggered in the same request.

 Well, LinkSubmit didn't works for me. But you are right that my problem was
in ordering of click events. So I got rid off action on click and all my
logic I put to "submitForm" handler. Type of action I send as a hidden
field. It starts finally work even in Safari and Opera.
Many thanks

Libor
-- 
View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28150868.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: submit form on Safari and Opera doesn't work

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 02 Apr 2010 02:02:00 -0300, LiborGMC <l....@gmc.net> wrote:

> What I'm trying to do is create actionLink (which call handleAction in
> Java). But before I handle this action I need some data on server. That  
> is way I call submit form before event is propagated to server.

You're complicating your implementation beyond needed. What you're trying  
is to do two requests in sequence: one to submit the form, other to handle  
an event. This is very error-prone, as it relies on the ordering of the  
arrival of the. Just use a LinkSubmit: the form will be submitted and the  
selected event will be triggered in the same request.

-- 
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: submit form on Safari and Opera doesn't work

Posted by LiborGMC <l....@gmc.net>.
Hi,
thanks for the reply. I've put code of "tml" file correctly but it has been
adjusted somehow. Here is the code of link again:
Submit 

What I'm trying to do is create actionLink (which call handleAction in
Java). But before I handle this action I need some data on server. That is
way I call submit form before event is propagated to server.
I've tried listener in JS aswell but in Safari and Opera cases it didn't
helps me. Could you guys try to run my code again please?

Libor
-- 
View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28116016.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: submit form on Safari and Opera doesn't work

Posted by Howard Lewis Ship <hl...@gmail.com>.
Earlier versions of T5 had a subtle bug.  If you used a t:submit
component without an explicit component id (no t:id attribute), it
would be assigned the default id "submit".  On the client side,
form.submit (normally a JavaScript function) would be replaced with a
reference to the submit element.

Solution? Give your t:submit component an explicit id.

On Thu, Apr 1, 2010 at 5:39 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Thu, 01 Apr 2010 02:25:48 -0300, LiborGMC <l....@gmc.net> wrote:
>
>> I've tried use Opera debugger just make sure that JS code with submit form
>> is called. Yes it is.
>
> I've tested your code in Opera 10.10 in Linux and it worked perfectly. I
> just added a link to submit the:
>
> <a href="#" id="link"
> onclick="document.getElementById('paTableForm').submit()">Submit</a>
>
> I haven't used JavaScript the right (using a listener instead of onclick)
> way because I wanted to do a test in a short time.
>
> By the way, there's a LinkSubmit component in Tapestry.
>
>> Java page:
>> @IncludeJavaScriptLibrary("context:js/index.js")
>> public class Index {
>>
>>        @Inject
>>        private ComponentResources resources;
>>
>>        @Property
>>        @Persist
>>        private String name;
>>
>>        @Property
>>        @Persist
>>        private String result;
>>
>>        public Object onSubmitFromPaTableForm(){
>>                return getCurrentPageName();
>>        }
>
> If you want this page to be rendered, return void or null. In you above
> method, you're forcing a redirect that is not needed.
>
>
>>         @OnEvent(component="handleAction")
>>                public Object handleAction(){
>>                 System.out.println( name);
>>                 result = name;
>>                 return getCurrentPageName();
>>         }
>
> This method is never invoked because there isn't a handleAction component.
> Thus, the result field is never updated.
>
>> This code works for me on Firefox 3 and IE8. It doesn't work on Safari 4,
>> Opera 9.64.
>
> What do you mean by this code doesn't work?
>
> --
> 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
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Re: submit form on Safari and Opera doesn't work

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 01 Apr 2010 02:25:48 -0300, LiborGMC <l....@gmc.net> wrote:

> I've tried use Opera debugger just make sure that JS code with submit  
> form is called. Yes it is.

I've tested your code in Opera 10.10 in Linux and it worked perfectly. I  
just added a link to submit the:

<a href="#" id="link"  
onclick="document.getElementById('paTableForm').submit()">Submit</a>

I haven't used JavaScript the right (using a listener instead of onclick)  
way because I wanted to do a test in a short time.

By the way, there's a LinkSubmit component in Tapestry.

> Java page:
> @IncludeJavaScriptLibrary("context:js/index.js")
> public class Index {
>
> 	@Inject
> 	private ComponentResources resources;
>
> 	@Property
> 	@Persist
> 	private String name;
> 	
> 	@Property
> 	@Persist
> 	private String result;
> 	
> 	public Object onSubmitFromPaTableForm(){
> 		return getCurrentPageName();
> 	}

If you want this page to be rendered, return void or null. In you above  
method, you're forcing a redirect that is not needed.


> 	 @OnEvent(component="handleAction")
> 		public Object handleAction(){
> 		 System.out.println( name);
> 		 result = name;
> 		 return getCurrentPageName();
> 	 }

This method is never invoked because there isn't a handleAction component.  
Thus, the result field is never updated.

> This code works for me on Firefox 3 and IE8. It doesn't work on Safari 4,
> Opera 9.64.

What do you mean by this code doesn't work?

-- 
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: submit form on Safari and Opera doesn't work

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 01 Apr 2010 02:25:48 -0300, LiborGMC <l....@gmc.net> wrote:

> This code works for me on Firefox 3 and IE8. It doesn't work on Safari 4,
> Opera 9.64.

Why Opera 9.64? The latest version is 10.52 in Windows, 10.1 in other  
operating systems.

I'm an Opera fan, use it all the time, including e-mail throgh IMAP and I  
always test my applications in it. Never had a problem with it.

-- 
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: submit form on Safari and Opera doesn't work

Posted by LiborGMC <l....@gmc.net>.
I've tried use Opera debugger just make sure that JS code with submit form is
called. Yes it is.
I've created simple web application in Tapestry 5.1.0.5. Just one form, one
textfield and one link which fire submit form. It DOESN'T WORK for me in
Safari and Opera at all. I post example of my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">

	<head>
		<title>WebTest</title>
	</head>
    <body>
 		<form  t:type="form" t:id="paTableForm">
 			<input t:type="TextField" id="name"  t:value="name"/>
 			 Submit 
 		</form>
 		
 		${result}
    </body>
</html>

JS file Index.js:
function submitForm(){
//try to use more ways how to submit form....
	document.paTableForm.submit();
	$('paTableForm').submit();
}

Java page:
@IncludeJavaScriptLibrary("context:js/index.js")
public class Index {

	@Inject
	private ComponentResources resources;

	@Property
	@Persist
	private String name;
	
	@Property
	@Persist
	private String result;
	
	public Object onSubmitFromPaTableForm(){
		return getCurrentPageName();
	}

	 private String getCurrentPageName(){
		 return resources.getPageName();
	 }

	 @OnEvent(component="handleAction")
		public Object handleAction(){
		 System.out.println( name);
		 result = name;
		 return getCurrentPageName();
	 }
}

This code works for me on Firefox 3 and IE8. It doesn't work on Safari 4,
Opera 9.64.
May anybody say what I'm doing wrong? I'm fighting with it for a few days!
Started to be frustrated from Tapestry.

Libor
-- 
View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28104646.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: submit form on Safari and Opera doesn't work

Posted by Michael Gentry <mg...@masslight.net>.
That's also what I'm using.

Have you tried using the JS debugger in Safari?  If you have Firebug
installed in Firefox, I'd try that one, too.

mrg


On Tue, Mar 30, 2010 at 8:51 AM, LiborGMC <l....@gmc.net> wrote:
>
> Thanks for the reply. I've tried your suggestions but it didn't helps me. I'm
> using Tapestry 5.1.0.5 with prototype.js 1.6.1. What version do you use?
> Libor
>
>
> I submit a form via JavaScript and it works in Safari, IE, and
> Firefox.  For me, I use:
>
> $('myFormID').submit();
>
>
> mrg
>
>
>
> --
> View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28082045.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: submit form on Safari and Opera doesn't work

Posted by LiborGMC <l....@gmc.net>.
Thanks for the reply. I've tried your suggestions but it didn't helps me. I'm
using Tapestry 5.1.0.5 with prototype.js 1.6.1. What version do you use?
Libor


I submit a form via JavaScript and it works in Safari, IE, and
Firefox.  For me, I use:

$('myFormID').submit();


mrg



-- 
View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28082045.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: submit form on Safari and Opera doesn't work

Posted by Michael Gentry <mg...@masslight.net>.
Oh, one more thing ... mine is being done when responding to a click
on a hyperlink.  I also had to kill the event (the hyperlink click):

	Event.stop(event);

Where event is the event from the hyperlink in my onClick handler.  My
form submit didn't work properly before adding this.

mrg


On Tue, Mar 30, 2010 at 8:42 AM, Michael Gentry <mg...@masslight.net> wrote:
> I submit a form via JavaScript and it works in Safari, IE, and
> Firefox.  For me, I use:
>
> $('myFormID').submit();
>
>
> mrg
>
>
> On Tue, Mar 30, 2010 at 8:26 AM, LiborGMC <l....@gmc.net> wrote:
>>
>> Hi,
>> thanks to issue with IE8
>> http://old.nabble.com/Error-in-tapestry.js-in-IE-8-ts27714386.html#a27904924
>> http://old.nabble.com/Error-in-tapestry.js-in-IE-8-ts27714386.html#a27904924
>> I removed all mixins and checkbox groups and I replaced them with simple
>> Javascript. But I struggling with strange problem on Opera 9.6 and Safari
>> 4.0.4. I'm not able submit form by Javascript on these browsers.
>> I've tried all well known possibilities like:
>> document.forms['paTableForm'].submit();
>> document.forms[0].submit();
>> document.paTableForm.submit();
>>
>> I've even created submit button and tried to fire click on it :
>> document.getElementById('submitTable').click();
>>
>> On IE8 , Firefox 3 and Chrome it works in every way. But in Opera and Safari
>> I'm not able to do so. Did anybody solve this issue? Can anybody help?
>>
>> Libor
>> --
>> View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28081757.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: submit form on Safari and Opera doesn't work

Posted by Michael Gentry <mg...@masslight.net>.
I submit a form via JavaScript and it works in Safari, IE, and
Firefox.  For me, I use:

$('myFormID').submit();


mrg


On Tue, Mar 30, 2010 at 8:26 AM, LiborGMC <l....@gmc.net> wrote:
>
> Hi,
> thanks to issue with IE8
> http://old.nabble.com/Error-in-tapestry.js-in-IE-8-ts27714386.html#a27904924
> http://old.nabble.com/Error-in-tapestry.js-in-IE-8-ts27714386.html#a27904924
> I removed all mixins and checkbox groups and I replaced them with simple
> Javascript. But I struggling with strange problem on Opera 9.6 and Safari
> 4.0.4. I'm not able submit form by Javascript on these browsers.
> I've tried all well known possibilities like:
> document.forms['paTableForm'].submit();
> document.forms[0].submit();
> document.paTableForm.submit();
>
> I've even created submit button and tried to fire click on it :
> document.getElementById('submitTable').click();
>
> On IE8 , Firefox 3 and Chrome it works in every way. But in Opera and Safari
> I'm not able to do so. Did anybody solve this issue? Can anybody help?
>
> Libor
> --
> View this message in context: http://old.nabble.com/submit-form-on-Safari-and-Opera-doesn%27t-work-tp28081757p28081757.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