You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matt Welch <ma...@welchkin.net> on 2009/02/10 15:12:42 UTC

AjaxSubmitLink submitting twice

I'm stumped. We have an AjaxSubmitLink and when clicked, the onSubmit of the
link is being executed twice. This is causing havok in our app. I've
winnowed it down to just the simplest example but I still see this taking
place. I'm not sure how to proceed. Here's the example code:
-------------------------
<!DOCTYPE html
		PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>
	<form action="#" wicket:id="testForm">
        <input wicket:id="keyword" type="text" />
         # Search 
	</form>
</body>
</html>
-------------------------
public class TestAjaxSubmitLink extends WebPage {
	private String fieldValue;

	public TestAjaxSubmitLink() {

		Form form = new Form("testForm");
		add(form);
		final TextField search = new TextField("keyword", new PropertyModel(this,
"fieldValue"));

		form.add(search);
		form.add(new AjaxSubmitLink("search"){
			protected void onSubmit(AjaxRequestTarget target, Form form) {
				System.out.println("Clicked Submit");
			}
		});
	}
}
-------------------------

We're using an older version of Wicket, but I tested this in 1.3.5 also and
got the same behavior. I find it hard to believe that we would be the first
to experience this behavior so I assume we're doing something wrong, but I'm
just not sure what it is. Any advice? 

-Matt
-- 
View this message in context: http://www.nabble.com/AjaxSubmitLink-submitting-twice-tp21934491p21934491.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: AjaxSubmitLink submitting twice

Posted by Igor Vaynberg <ig...@gmail.com>.
just add Thread.dumpStack() to the onsubmit() and see the two places
its being called from. you can also add something like
System.out.println(getrequestcycle().getrequest()) to see if the same
request is initiating both calls.


-igor

On Tue, Feb 10, 2009 at 2:35 PM, Matt Welch <ma...@welchkin.net> wrote:
>
> The Nabble posting process correctly escaped all of the HTML tags except the
> which it rendered as HTML. I only just now figured out I needed to use a
> "raw" tag. The raw HTML is below.
>
> As expected though, this same code works fine in a quickstart. I never
> suspected that it was a bug, which is why I didn't post a JIRA issue. I knew
> something this simple wouldn't have been missed. It's clearly a problem with
> our configuration, but I don't know where to start looking.
>
> Using this simple test page, the final rendered page contains no extra
> javascript beyond the wicket stuff to support the button submission which I
> know works. This test page isn't going through our security framework
> because I extended WebPage instead of our application's SecureWebPage (using
> wicket-security). That leaves servlet filters (Spring's OpenSessionInView
> and the normal WicketFilter), our session implementation or the
> WebApplication itself.
>
> Does anyone have any suggestions about where I might plop down a breakpoint
> in an attempt to debug this issue?
>
> -Matt
>
>
> <!DOCTYPE html
>                PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <body>
>        <form action="#" wicket:id="testForm">
>        <input wicket:id="keyword" type="text" />
>         # Search
>        </form>
> </body>
> </html>
>
>
>
>
>
>
> igor.vaynberg wrote:
>>
>> your example markup does not contain "search" component. it is much
>> better to open a jira issue and attach a quickstart that reproduces
>> the problem.
>>
>> -igor
>>
>> On Tue, Feb 10, 2009 at 6:12 AM, Matt Welch <ma...@welchkin.net> wrote:
>>>
>>> I'm stumped. We have an AjaxSubmitLink and when clicked, the onSubmit of
>>> the
>>> link is being executed twice. This is causing havok in our app. I've
>>> winnowed it down to just the simplest example but I still see this taking
>>> place. I'm not sure how to proceed. Here's the example code:
>>> -------------------------
>>> <!DOCTYPE html
>>>                PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>>> <body>
>>>        <form action="#" wicket:id="testForm">
>>>        <input wicket:id="keyword" type="text" />
>>>         # Search
>>>        </form>
>>> </body>
>>> </html>
>>> -------------------------
>>> public class TestAjaxSubmitLink extends WebPage {
>>>        private String fieldValue;
>>>
>>>        public TestAjaxSubmitLink() {
>>>
>>>                Form form = new Form("testForm");
>>>                add(form);
>>>                final TextField search = new TextField("keyword", new
>>> PropertyModel(this,
>>> "fieldValue"));
>>>
>>>                form.add(search);
>>>                form.add(new AjaxSubmitLink("search"){
>>>                        protected void onSubmit(AjaxRequestTarget target,
>>> Form form) {
>>>                                System.out.println("Clicked Submit");
>>>                        }
>>>                });
>>>        }
>>> }
>>> -------------------------
>>>
>>> We're using an older version of Wicket, but I tested this in 1.3.5 also
>>> and
>>> got the same behavior. I find it hard to believe that we would be the
>>> first
>>> to experience this behavior so I assume we're doing something wrong, but
>>> I'm
>>> just not sure what it is. Any advice?
>>>
>>> -Matt
>>> --
>>> View this message in context:
>>> http://www.nabble.com/AjaxSubmitLink-submitting-twice-tp21934491p21934491.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/AjaxSubmitLink-submitting-twice-tp21934491p21944134.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Problems with ListMultipleChoice component

Posted by David R Robison <dr...@openroadsconsulting.com>.
Opps... Due to a cut and paste error I had default form processing set 
to false. Now don't I feel silly! Thanks, David

David R Robison wrote:
> Yes, and thanks for the quick response. What is missing from the 
> example is how to read the list of selected items. Here is some of my 
> code fragments. Any thoughts?
>
>        private LinkedList<DeviceGeneric> addDevicesList = new 
> LinkedList<DeviceGeneric>();
>        ...
>        add(new ListMultipleChoice("devicesOutChain", new 
> PropertyModel(this, "addDevicesList"), createListOfOptions()));
>
> My thoughts was that "addDeviceList" would then contain the list of 
> DeviceGeneric items that were selected from the list created by 
> createListOfOptions(). Am I missing something here? David
>
>
> Timo Rantalaiho wrote:
>> On Wed, 18 Feb 2009, David R Robison wrote:
>>  
>>> I'm having trouble with the ListMultipleChoice component. It 
>>> displays correctly, but when I submit the form, the server side code 
>>> does not see any items selected. Any thoughts? Can anyone point me 
>>> to a good example?     
>>
>> Have you checked out wicket-examples from svn and then checked out this?
>>
>>   
>> http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.ListMultipleChoicePage 
>>
>>
>> Best wishes,
>> Timo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>   
>

-- 

David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.  



 




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


Re: Problems with ListMultipleChoice component

Posted by David R Robison <dr...@openroadsconsulting.com>.
Yes, and thanks for the quick response. What is missing from the example 
is how to read the list of selected items. Here is some of my code 
fragments. Any thoughts?

        private LinkedList<DeviceGeneric> addDevicesList = new 
LinkedList<DeviceGeneric>();
        ...
        add(new ListMultipleChoice("devicesOutChain", new 
PropertyModel(this, "addDevicesList"), createListOfOptions()));

My thoughts was that "addDeviceList" would then contain the list of 
DeviceGeneric items that were selected from the list created by 
createListOfOptions(). Am I missing something here? David


Timo Rantalaiho wrote:
> On Wed, 18 Feb 2009, David R Robison wrote:
>   
>> I'm having trouble with the ListMultipleChoice component. It displays 
>> correctly, but when I submit the form, the server side code does not see 
>> any items selected. Any thoughts? Can anyone point me to a good example? 
>>     
>
> Have you checked out wicket-examples from svn and then 
> checked out this?
>
>   http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.ListMultipleChoicePage
>
> Best wishes,
> Timo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   

-- 

David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579

This e-mail communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.  If you are not the intended recipient, you should immediately stop reading this message and delete it from all computers that it resides on. Any unauthorized reading, distribution, copying or other use of this communication (or its attachments) is strictly prohibited.  If you have received this communication in error, please notify us immediately.  



 


Re: Problems with ListMultipleChoice component

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Wed, 18 Feb 2009, David R Robison wrote:
> I'm having trouble with the ListMultipleChoice component. It displays 
> correctly, but when I submit the form, the server side code does not see 
> any items selected. Any thoughts? Can anyone point me to a good example? 

Have you checked out wicket-examples from svn and then 
checked out this?

  http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.ListMultipleChoicePage

Best wishes,
Timo


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


Problems with ListMultipleChoice component

Posted by David R Robison <dr...@openroadsconsulting.com>.
I'm having trouble with the ListMultipleChoice component. It displays 
correctly, but when I submit the form, the server side code does not see 
any items selected. Any thoughts? Can anyone point me to a good example? 
Thanks, David

-- 

David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: drrobison@openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579


 




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


Re: AjaxSubmitLink submitting twice

Posted by Matt Welch <ma...@welchkin.net>.
I finally did find the root of this problem and wanted to report back to
other Wicket users in case they ever had a similar issue and found this
thread in a search. It turns out that the problem is somehow related to the
Firebug add-on for Firefox. Doing some searching, I can see that Firebug has
had similar issue in the past, however they are supposed all fixed, but the
issue was definitely related, at least in some way, to Firebug. 

Firebug has a feature that allows you put logging statements into your
javascript code with console.log() statements. If that feature was turned on
(i.e. the "Console" option was checked in the "Net" tab of Firebug) then I
would get the behavior I described. Turned off? Everything was fine.

I was using Firebug 1.3.2 with Firefox 3.0. For some reason Firefox had
never prompted me for an update as it had on my other computers. When I
updated to Firefox 3.0.6 I could not longer reproduce the issue. 

The moral, I guess, is to keep your browser up-to-date.

Matt


Matt Welch wrote:
> 
> The Nabble posting process correctly escaped all of the HTML tags except
> the   which it rendered as HTML. I only just now figured out I needed to
> use a "raw" tag. The raw HTML is below.
> 
> As expected though, this same code works fine in a quickstart. I never
> suspected that it was a bug, which is why I didn't post a JIRA issue. I
> knew something this simple wouldn't have been missed. It's clearly a
> problem with our configuration, but I don't know where to start looking. 
> 
> Using this simple test page, the final rendered page contains no extra
> javascript beyond the wicket stuff to support the button submission which
> I know works. This test page isn't going through our security framework
> because I extended WebPage instead of our application's SecureWebPage
> (using wicket-security). That leaves servlet filters (Spring's
> OpenSessionInView and the normal WicketFilter), our session implementation
> or the WebApplication itself. 
> 
> Does anyone have any suggestions about where I might plop down a
> breakpoint in an attempt to debug this issue?
> 
> -Matt
> 
> 
> <!DOCTYPE html
> 		PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> 		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <body>
> 	<form action="#" wicket:id="testForm">
>         <input wicket:id="keyword" type="text" />
>          # Search 
> 	</form>
> </body>
> </html>
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxSubmitLink-submitting-twice-tp21934491p22087057.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: AjaxSubmitLink submitting twice

Posted by Matt Welch <ma...@welchkin.net>.
The Nabble posting process correctly escaped all of the HTML tags except the  
which it rendered as HTML. I only just now figured out I needed to use a
"raw" tag. The raw HTML is below.

As expected though, this same code works fine in a quickstart. I never
suspected that it was a bug, which is why I didn't post a JIRA issue. I knew
something this simple wouldn't have been missed. It's clearly a problem with
our configuration, but I don't know where to start looking. 

Using this simple test page, the final rendered page contains no extra
javascript beyond the wicket stuff to support the button submission which I
know works. This test page isn't going through our security framework
because I extended WebPage instead of our application's SecureWebPage (using
wicket-security). That leaves servlet filters (Spring's OpenSessionInView
and the normal WicketFilter), our session implementation or the
WebApplication itself. 

Does anyone have any suggestions about where I might plop down a breakpoint
in an attempt to debug this issue?

-Matt


<!DOCTYPE html
		PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>
	<form action="#" wicket:id="testForm">
        <input wicket:id="keyword" type="text" />
         # Search 
	</form>
</body>
</html>






igor.vaynberg wrote:
> 
> your example markup does not contain "search" component. it is much
> better to open a jira issue and attach a quickstart that reproduces
> the problem.
> 
> -igor
> 
> On Tue, Feb 10, 2009 at 6:12 AM, Matt Welch <ma...@welchkin.net> wrote:
>>
>> I'm stumped. We have an AjaxSubmitLink and when clicked, the onSubmit of
>> the
>> link is being executed twice. This is causing havok in our app. I've
>> winnowed it down to just the simplest example but I still see this taking
>> place. I'm not sure how to proceed. Here's the example code:
>> -------------------------
>> <!DOCTYPE html
>>                PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>> <body>
>>        <form action="#" wicket:id="testForm">
>>        <input wicket:id="keyword" type="text" />
>>         # Search
>>        </form>
>> </body>
>> </html>
>> -------------------------
>> public class TestAjaxSubmitLink extends WebPage {
>>        private String fieldValue;
>>
>>        public TestAjaxSubmitLink() {
>>
>>                Form form = new Form("testForm");
>>                add(form);
>>                final TextField search = new TextField("keyword", new
>> PropertyModel(this,
>> "fieldValue"));
>>
>>                form.add(search);
>>                form.add(new AjaxSubmitLink("search"){
>>                        protected void onSubmit(AjaxRequestTarget target,
>> Form form) {
>>                                System.out.println("Clicked Submit");
>>                        }
>>                });
>>        }
>> }
>> -------------------------
>>
>> We're using an older version of Wicket, but I tested this in 1.3.5 also
>> and
>> got the same behavior. I find it hard to believe that we would be the
>> first
>> to experience this behavior so I assume we're doing something wrong, but
>> I'm
>> just not sure what it is. Any advice?
>>
>> -Matt
>> --
>> View this message in context:
>> http://www.nabble.com/AjaxSubmitLink-submitting-twice-tp21934491p21934491.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxSubmitLink-submitting-twice-tp21934491p21944134.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: AjaxSubmitLink submitting twice

Posted by Igor Vaynberg <ig...@gmail.com>.
your example markup does not contain "search" component. it is much
better to open a jira issue and attach a quickstart that reproduces
the problem.

-igor

On Tue, Feb 10, 2009 at 6:12 AM, Matt Welch <ma...@welchkin.net> wrote:
>
> I'm stumped. We have an AjaxSubmitLink and when clicked, the onSubmit of the
> link is being executed twice. This is causing havok in our app. I've
> winnowed it down to just the simplest example but I still see this taking
> place. I'm not sure how to proceed. Here's the example code:
> -------------------------
> <!DOCTYPE html
>                PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <body>
>        <form action="#" wicket:id="testForm">
>        <input wicket:id="keyword" type="text" />
>         # Search
>        </form>
> </body>
> </html>
> -------------------------
> public class TestAjaxSubmitLink extends WebPage {
>        private String fieldValue;
>
>        public TestAjaxSubmitLink() {
>
>                Form form = new Form("testForm");
>                add(form);
>                final TextField search = new TextField("keyword", new PropertyModel(this,
> "fieldValue"));
>
>                form.add(search);
>                form.add(new AjaxSubmitLink("search"){
>                        protected void onSubmit(AjaxRequestTarget target, Form form) {
>                                System.out.println("Clicked Submit");
>                        }
>                });
>        }
> }
> -------------------------
>
> We're using an older version of Wicket, but I tested this in 1.3.5 also and
> got the same behavior. I find it hard to believe that we would be the first
> to experience this behavior so I assume we're doing something wrong, but I'm
> just not sure what it is. Any advice?
>
> -Matt
> --
> View this message in context: http://www.nabble.com/AjaxSubmitLink-submitting-twice-tp21934491p21934491.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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