You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ryan <wi...@mandrake.us> on 2008/11/10 23:03:08 UTC

FallbackSubmitLink (yes it sounds crazy)

I have a DataView component and each row has a CheckBox to select that
row. I prefer not to have an ajax call on each selection by the user.
The issue is that with the default PagingNavigator I lose which
checkboxes were selected when the page is changed (naturally, because the
form is not submitted).

I can make a PagingNavigator that uses SubmitLink, but then I lose
pagination for those without javascript (rare, I know).

SubmitLink uses the onclick handler (despite what the javadoc says, see
WICKET-1925), and its href is set to #. I was planning on making a
FallbackSubmitLink with the same onclick as SubmitLink and the same href
as a regular Link. I just need to make sure that the onclick always
returns false so browsers with javascript will not follow the href.

If such a component existed, users with javascript would be able to
paginate without losing selections. Those without javascript can still
paginate, but the checkboxes do not stay checked across pages.

My questions are... has anyone built something like this already? Is there
a better way?

Thanks!
Ryan

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


Re: FallbackSubmitLink (yes it sounds crazy)

Posted by Igor Vaynberg <ig...@gmail.com>.
On Tue, Nov 11, 2008 at 9:53 AM, Ryan <wi...@mandrake.us> wrote:
> Thanks again Igor, your always quick to respond and a huge help!

you are welcome

-igor

> -Ryan
>
> On Tue, Nov 11, 2008 at 09:26:44AM -0800, Igor Vaynberg exclaimed:
>
>>the naming is bad since in wicket "fallback" means it still does the
>>exact same thing albeit without ajax/js. i think if you want that kind
>>of behavior you will have to roll your own link, possibly extending
>>from abstractsubmitlink.
>>
>>-igor
>>
>>On Tue, Nov 11, 2008 at 9:14 AM, Ryan <wi...@mandrake.us> wrote:
>>> Currently SubmitLink sets the to href='#', instead it would have a valid
>>> href (similar to a regular Link). The onclick would still submit the
>>> form but return false to prevent the href being followed in javascript
>>> browswers.
>>>
>>> Then the you have 1 of 2 cases:
>>> 1) the browswer has javascript and runs the onclick handler, which
>>> returns false so the href is not followed. This is standard SubmitLink
>>> behavior.
>>>
>>> 2) the browser does not support javascript, completely ignores the
>>> onclick handler and instead follows the href. This *does not* submit the
>>> form. This is standard Link behavior.
>>>
>>> The usecase for this is when you have a form that would be nice to
>>> submit, but its not required that it be submitted (such as pagination).
>>> I realize this is a very weird corner case. At this point the design
>>> calls for a lot of stuff that cannot be done without javascript so I am
>>> probably going to just use submitlink anyway.
>>>
>>> I only asked on the list to see if someone had done the work for something
>>> like this already.
>>>
>>> Thanks!
>>> -Ryan
>>>
>>> On Tue, Nov 11, 2008 at 08:52:50AM -0800, Igor Vaynberg exclaimed:
>>>
>>>>you cannot have a submitLINK and not have javascript. what would your
>>>>href be? links do not submit forms, only buttons do.
>>>>
>>>>-igor
>>>>
>>>>On Mon, Nov 10, 2008 at 2:03 PM, Ryan <wi...@mandrake.us> wrote:
>>>>> I have a DataView component and each row has a CheckBox to select that
>>>>> row. I prefer not to have an ajax call on each selection by the user.
>>>>> The issue is that with the default PagingNavigator I lose which
>>>>> checkboxes were selected when the page is changed (naturally, because the
>>>>> form is not submitted).
>>>>>
>>>>> I can make a PagingNavigator that uses SubmitLink, but then I lose
>>>>> pagination for those without javascript (rare, I know).
>>>>>
>>>>> SubmitLink uses the onclick handler (despite what the javadoc says, see
>>>>> WICKET-1925), and its href is set to #. I was planning on making a
>>>>> FallbackSubmitLink with the same onclick as SubmitLink and the same href
>>>>> as a regular Link. I just need to make sure that the onclick always
>>>>> returns false so browsers with javascript will not follow the href.
>>>>>
>>>>> If such a component existed, users with javascript would be able to
>>>>> paginate without losing selections. Those without javascript can still
>>>>> paginate, but the checkboxes do not stay checked across pages.
>>>>>
>>>>> My questions are... has anyone built something like this already? Is there
>>>>> a better way?
>>>>>
>>>>> Thanks!
>>>>> Ryan
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
> ---------------------------------------------------------------------
> 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: FallbackSubmitLink (yes it sounds crazy)

Posted by Ryan <wi...@mandrake.us>.
Yes, the name I chose was misleading. There was a discussion back in
January about PagingNavigator.newPagingNavigationIncrementLink and
PagingNavigator.newPagingNavigationLink returning Link objects and not
AbstractLink objects. I could not find a JIRA issue for the enhancement
so I created one https://issues.apache.org/jira/browse/WICKET-1929 .

The original discussion is here:
http://markmail.org/message/dfgnis2rc7ysjlhj

Thanks again Igor, your always quick to respond and a huge help!
-Ryan

On Tue, Nov 11, 2008 at 09:26:44AM -0800, Igor Vaynberg exclaimed:

>the naming is bad since in wicket "fallback" means it still does the
>exact same thing albeit without ajax/js. i think if you want that kind
>of behavior you will have to roll your own link, possibly extending
>from abstractsubmitlink.
>
>-igor
>
>On Tue, Nov 11, 2008 at 9:14 AM, Ryan <wi...@mandrake.us> wrote:
>> Currently SubmitLink sets the to href='#', instead it would have a valid
>> href (similar to a regular Link). The onclick would still submit the
>> form but return false to prevent the href being followed in javascript
>> browswers.
>>
>> Then the you have 1 of 2 cases:
>> 1) the browswer has javascript and runs the onclick handler, which
>> returns false so the href is not followed. This is standard SubmitLink
>> behavior.
>>
>> 2) the browser does not support javascript, completely ignores the
>> onclick handler and instead follows the href. This *does not* submit the
>> form. This is standard Link behavior.
>>
>> The usecase for this is when you have a form that would be nice to
>> submit, but its not required that it be submitted (such as pagination).
>> I realize this is a very weird corner case. At this point the design
>> calls for a lot of stuff that cannot be done without javascript so I am
>> probably going to just use submitlink anyway.
>>
>> I only asked on the list to see if someone had done the work for something
>> like this already.
>>
>> Thanks!
>> -Ryan
>>
>> On Tue, Nov 11, 2008 at 08:52:50AM -0800, Igor Vaynberg exclaimed:
>>
>>>you cannot have a submitLINK and not have javascript. what would your
>>>href be? links do not submit forms, only buttons do.
>>>
>>>-igor
>>>
>>>On Mon, Nov 10, 2008 at 2:03 PM, Ryan <wi...@mandrake.us> wrote:
>>>> I have a DataView component and each row has a CheckBox to select that
>>>> row. I prefer not to have an ajax call on each selection by the user.
>>>> The issue is that with the default PagingNavigator I lose which
>>>> checkboxes were selected when the page is changed (naturally, because the
>>>> form is not submitted).
>>>>
>>>> I can make a PagingNavigator that uses SubmitLink, but then I lose
>>>> pagination for those without javascript (rare, I know).
>>>>
>>>> SubmitLink uses the onclick handler (despite what the javadoc says, see
>>>> WICKET-1925), and its href is set to #. I was planning on making a
>>>> FallbackSubmitLink with the same onclick as SubmitLink and the same href
>>>> as a regular Link. I just need to make sure that the onclick always
>>>> returns false so browsers with javascript will not follow the href.
>>>>
>>>> If such a component existed, users with javascript would be able to
>>>> paginate without losing selections. Those without javascript can still
>>>> paginate, but the checkboxes do not stay checked across pages.
>>>>
>>>> My questions are... has anyone built something like this already? Is there
>>>> a better way?
>>>>
>>>> Thanks!
>>>> Ryan
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>> ---------------------------------------------------------------------
>> 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

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


Re: FallbackSubmitLink (yes it sounds crazy)

Posted by Igor Vaynberg <ig...@gmail.com>.
the naming is bad since in wicket "fallback" means it still does the
exact same thing albeit without ajax/js. i think if you want that kind
of behavior you will have to roll your own link, possibly extending
from abstractsubmitlink.

-igor

On Tue, Nov 11, 2008 at 9:14 AM, Ryan <wi...@mandrake.us> wrote:
> Currently SubmitLink sets the to href='#', instead it would have a valid
> href (similar to a regular Link). The onclick would still submit the
> form but return false to prevent the href being followed in javascript
> browswers.
>
> Then the you have 1 of 2 cases:
> 1) the browswer has javascript and runs the onclick handler, which
> returns false so the href is not followed. This is standard SubmitLink
> behavior.
>
> 2) the browser does not support javascript, completely ignores the
> onclick handler and instead follows the href. This *does not* submit the
> form. This is standard Link behavior.
>
> The usecase for this is when you have a form that would be nice to
> submit, but its not required that it be submitted (such as pagination).
> I realize this is a very weird corner case. At this point the design
> calls for a lot of stuff that cannot be done without javascript so I am
> probably going to just use submitlink anyway.
>
> I only asked on the list to see if someone had done the work for something
> like this already.
>
> Thanks!
> -Ryan
>
> On Tue, Nov 11, 2008 at 08:52:50AM -0800, Igor Vaynberg exclaimed:
>
>>you cannot have a submitLINK and not have javascript. what would your
>>href be? links do not submit forms, only buttons do.
>>
>>-igor
>>
>>On Mon, Nov 10, 2008 at 2:03 PM, Ryan <wi...@mandrake.us> wrote:
>>> I have a DataView component and each row has a CheckBox to select that
>>> row. I prefer not to have an ajax call on each selection by the user.
>>> The issue is that with the default PagingNavigator I lose which
>>> checkboxes were selected when the page is changed (naturally, because the
>>> form is not submitted).
>>>
>>> I can make a PagingNavigator that uses SubmitLink, but then I lose
>>> pagination for those without javascript (rare, I know).
>>>
>>> SubmitLink uses the onclick handler (despite what the javadoc says, see
>>> WICKET-1925), and its href is set to #. I was planning on making a
>>> FallbackSubmitLink with the same onclick as SubmitLink and the same href
>>> as a regular Link. I just need to make sure that the onclick always
>>> returns false so browsers with javascript will not follow the href.
>>>
>>> If such a component existed, users with javascript would be able to
>>> paginate without losing selections. Those without javascript can still
>>> paginate, but the checkboxes do not stay checked across pages.
>>>
>>> My questions are... has anyone built something like this already? Is there
>>> a better way?
>>>
>>> Thanks!
>>> Ryan
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
> ---------------------------------------------------------------------
> 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: FallbackSubmitLink (yes it sounds crazy)

Posted by Ryan <wi...@mandrake.us>.
Currently SubmitLink sets the to href='#', instead it would have a valid
href (similar to a regular Link). The onclick would still submit the
form but return false to prevent the href being followed in javascript
browswers.

Then the you have 1 of 2 cases:
1) the browswer has javascript and runs the onclick handler, which
returns false so the href is not followed. This is standard SubmitLink
behavior.

2) the browser does not support javascript, completely ignores the
onclick handler and instead follows the href. This *does not* submit the
form. This is standard Link behavior.

The usecase for this is when you have a form that would be nice to
submit, but its not required that it be submitted (such as pagination).
I realize this is a very weird corner case. At this point the design
calls for a lot of stuff that cannot be done without javascript so I am
probably going to just use submitlink anyway.

I only asked on the list to see if someone had done the work for something
like this already.

Thanks!
-Ryan

On Tue, Nov 11, 2008 at 08:52:50AM -0800, Igor Vaynberg exclaimed:

>you cannot have a submitLINK and not have javascript. what would your
>href be? links do not submit forms, only buttons do.
>
>-igor
>
>On Mon, Nov 10, 2008 at 2:03 PM, Ryan <wi...@mandrake.us> wrote:
>> I have a DataView component and each row has a CheckBox to select that
>> row. I prefer not to have an ajax call on each selection by the user.
>> The issue is that with the default PagingNavigator I lose which
>> checkboxes were selected when the page is changed (naturally, because the
>> form is not submitted).
>>
>> I can make a PagingNavigator that uses SubmitLink, but then I lose
>> pagination for those without javascript (rare, I know).
>>
>> SubmitLink uses the onclick handler (despite what the javadoc says, see
>> WICKET-1925), and its href is set to #. I was planning on making a
>> FallbackSubmitLink with the same onclick as SubmitLink and the same href
>> as a regular Link. I just need to make sure that the onclick always
>> returns false so browsers with javascript will not follow the href.
>>
>> If such a component existed, users with javascript would be able to
>> paginate without losing selections. Those without javascript can still
>> paginate, but the checkboxes do not stay checked across pages.
>>
>> My questions are... has anyone built something like this already? Is there
>> a better way?
>>
>> Thanks!
>> Ryan
>>
>> ---------------------------------------------------------------------
>> 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

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


Re: FallbackSubmitLink (yes it sounds crazy)

Posted by Igor Vaynberg <ig...@gmail.com>.
you cannot have a submitLINK and not have javascript. what would your
href be? links do not submit forms, only buttons do.

-igor

On Mon, Nov 10, 2008 at 2:03 PM, Ryan <wi...@mandrake.us> wrote:
> I have a DataView component and each row has a CheckBox to select that
> row. I prefer not to have an ajax call on each selection by the user.
> The issue is that with the default PagingNavigator I lose which
> checkboxes were selected when the page is changed (naturally, because the
> form is not submitted).
>
> I can make a PagingNavigator that uses SubmitLink, but then I lose
> pagination for those without javascript (rare, I know).
>
> SubmitLink uses the onclick handler (despite what the javadoc says, see
> WICKET-1925), and its href is set to #. I was planning on making a
> FallbackSubmitLink with the same onclick as SubmitLink and the same href
> as a regular Link. I just need to make sure that the onclick always
> returns false so browsers with javascript will not follow the href.
>
> If such a component existed, users with javascript would be able to
> paginate without losing selections. Those without javascript can still
> paginate, but the checkboxes do not stay checked across pages.
>
> My questions are... has anyone built something like this already? Is there
> a better way?
>
> Thanks!
> Ryan
>
> ---------------------------------------------------------------------
> 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