You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by AH Jaworski <an...@lostlemon.nl> on 2011/02/22 11:17:44 UTC

Refresh to top after submit() in dynamic form

Ive implemented a dynamic form as shown in the example: 
http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm

After the submit takes place, you're redirected to the top of the page. 
This is good when you have a small form, but with bigger forms it is not 
very user friendly. Is there a way to avoid this behaviour? Maybe a 
solution which includes anchoring or something like that?

Thanks in advance



Re: Refresh to top after submit() in dynamic form

Posted by AH Jaworski <an...@lostlemon.nl>.
I just try to keep the plugins minimized and instead of absolute 
positioning of such values, I would like to add tags to elements, which 
in the future can change position and whatsoever. With html anchors I 
maybe also can try to make a workaround for a no-script mode.

Op 23-2-2011 13:41, Bob Schellink schreef:
> On 2011/02/23 14:29 PM, AH Jaworski wrote:
>> Yes, but for accessibility reasons, the anchoring method would be in my favour.
> How come? Do you mean if they switch off JS or do you mean someone with a reader or something else?
>

Re: Refresh to top after submit() in dynamic form

Posted by Bob Schellink <sa...@gmail.com>.
On 2011/02/23 14:29 PM, AH Jaworski wrote:
> Yes, but for accessibility reasons, the anchoring method would be in my favour.

How come? Do you mean if they switch off JS or do you mean someone with a reader or something else?

Re: Refresh to top after submit() in dynamic form

Posted by AH Jaworski <an...@lostlemon.nl>.
Thanks Axel, your solution is working!


Op 23-2-2011 13:38, Axel Morgner schreef:
> Then maybe append the anchor part via JS to the form action url:
>
> checkbox.setAttribute("onclick", "this.form.action = this.form.action 
> + '#anchor'; form.submit();");
>
> (untested!!)
>
> Axel
>
> [1] 
> http://stackoverflow.com/questions/979024/changing-the-action-of-a-form-with-javascript-jquery
>
> Am 23.02.2011 13:29, schrieb AH Jaworski:
>> Yes, but for accessibility reasons, the anchoring method would be in 
>> my favour.
>>
>> Regards,
>>
>> Antek
>>
>> Op 23-2-2011 13:05, Bob Schellink schreef:
>>> Hi,
>>>
>>> Isn't easier to use JS to accomplish this? You could store the pageY 
>>> offset and restore it when the
>>> page loads? jQuery or other JS libs might even have plugins for this.
>>>
>>> Kind regards
>>>
>>> Bob
>>>
>>> On 2011/02/23 13:56 PM, AH Jaworski wrote:
>>>> Yes, I think this would be the ideal solution, but the 
>>>> setActionURL() does not set the actionurl for
>>>> the already rendered form. After the submit the actionurl is 
>>>> updated, but then I need another
>>>> refresh to go to the anchor.
>>>>
>>>> Is there a way to override the actionurl of the form triggered by 
>>>> an onclick-action?
>>>>
>>>> Regards,
>>>> Antek
>>>>
>>>>
>>>> Op 22-2-2011 12:26, Axel Morgner schreef:
>>>>> Or as an alternative, try
>>>>>
>>>>>      
>>>>> myForm.setActionURL(myForm.getActionURL().concat("#anchor-123"));
>>>>>
>>>>> Axel
>>>>>
>>>>> On 22.02.2011 12:23, Axel Morgner wrote:
>>>>>> You're right.
>>>>>>
>>>>>> Is it an option for you to set the form action URL explicitely? 
>>>>>> E.g. like
>>>>>>
>>>>>>      myForm.setActionURL("my-page.htm#anchor-123");
>>>>>>
>>>>>> Greetings
>>>>>>
>>>>>> Axel
>>>>>>
>>>>>> On 22.02.2011 12:11, AH Jaworski wrote:
>>>>>>> But in the dynamic form the refresh gets initiated with: 
>>>>>>> checkbox.setAttribute("onclick",
>>>>>>> "form.submit();");
>>>>>>>
>>>>>>> I don't think it's possible to give a parameter with the submit 
>>>>>>> or is it?
>>>>>>> greets
>>>>>>> Antek
>>>>>>>
>>>>>>> Op 22-2-2011 12:03, Axel Morgner schreef:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> good question. I've helped myself by adding something like that:
>>>>>>>>
>>>>>>>>      setRedirect(getRedirect().concat("#anchor-123"));
>>>>>>>>
>>>>>>>> I'm using anchors to set the active tab, together with 
>>>>>>>> jquery-tabs.
>>>>>>>>
>>>>>>>> Support for anchors in Click would be cool ...
>>>>>>>>
>>>>>>>> Greetings
>>>>>>>>
>>>>>>>> Axel
>>>>>>>>
>>>>>>>> On 22.02.2011 11:17, AH Jaworski wrote:
>>>>>>>>> Ive implemented a dynamic form as shown in the example:
>>>>>>>>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> After the submit takes place, you're redirected to the top of 
>>>>>>>>> the page. This is good when you
>>>>>>>>> have a small form, but with bigger forms it is not very user 
>>>>>>>>> friendly. Is there a way to avoid
>>>>>>>>> this behaviour? Maybe a solution which includes anchoring or 
>>>>>>>>> something like that?
>>>>>>>>>
>>>>>>>>> Thanks in advance
>>>>>>>>>
>>>>>>>>>
>>>>>
>

Re: Refresh to top after submit() in dynamic form

Posted by Axel Morgner <ax...@morgner.de>.
Then maybe append the anchor part via JS to the form action url:

checkbox.setAttribute("onclick", "this.form.action = this.form.action + 
'#anchor'; form.submit();");

(untested!!)

Axel

[1] 
http://stackoverflow.com/questions/979024/changing-the-action-of-a-form-with-javascript-jquery

Am 23.02.2011 13:29, schrieb AH Jaworski:
> Yes, but for accessibility reasons, the anchoring method would be in 
> my favour.
>
> Regards,
>
> Antek
>
> Op 23-2-2011 13:05, Bob Schellink schreef:
>> Hi,
>>
>> Isn't easier to use JS to accomplish this? You could store the pageY 
>> offset and restore it when the
>> page loads? jQuery or other JS libs might even have plugins for this.
>>
>> Kind regards
>>
>> Bob
>>
>> On 2011/02/23 13:56 PM, AH Jaworski wrote:
>>> Yes, I think this would be the ideal solution, but the 
>>> setActionURL() does not set the actionurl for
>>> the already rendered form. After the submit the actionurl is 
>>> updated, but then I need another
>>> refresh to go to the anchor.
>>>
>>> Is there a way to override the actionurl of the form triggered by an 
>>> onclick-action?
>>>
>>> Regards,
>>> Antek
>>>
>>>
>>> Op 22-2-2011 12:26, Axel Morgner schreef:
>>>> Or as an alternative, try
>>>>
>>>>      myForm.setActionURL(myForm.getActionURL().concat("#anchor-123"));
>>>>
>>>> Axel
>>>>
>>>> On 22.02.2011 12:23, Axel Morgner wrote:
>>>>> You're right.
>>>>>
>>>>> Is it an option for you to set the form action URL explicitely? 
>>>>> E.g. like
>>>>>
>>>>>      myForm.setActionURL("my-page.htm#anchor-123");
>>>>>
>>>>> Greetings
>>>>>
>>>>> Axel
>>>>>
>>>>> On 22.02.2011 12:11, AH Jaworski wrote:
>>>>>> But in the dynamic form the refresh gets initiated with: 
>>>>>> checkbox.setAttribute("onclick",
>>>>>> "form.submit();");
>>>>>>
>>>>>> I don't think it's possible to give a parameter with the submit 
>>>>>> or is it?
>>>>>> greets
>>>>>> Antek
>>>>>>
>>>>>> Op 22-2-2011 12:03, Axel Morgner schreef:
>>>>>>> Hi,
>>>>>>>
>>>>>>> good question. I've helped myself by adding something like that:
>>>>>>>
>>>>>>>      setRedirect(getRedirect().concat("#anchor-123"));
>>>>>>>
>>>>>>> I'm using anchors to set the active tab, together with jquery-tabs.
>>>>>>>
>>>>>>> Support for anchors in Click would be cool ...
>>>>>>>
>>>>>>> Greetings
>>>>>>>
>>>>>>> Axel
>>>>>>>
>>>>>>> On 22.02.2011 11:17, AH Jaworski wrote:
>>>>>>>> Ive implemented a dynamic form as shown in the example:
>>>>>>>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm 
>>>>>>>>
>>>>>>>>
>>>>>>>> After the submit takes place, you're redirected to the top of 
>>>>>>>> the page. This is good when you
>>>>>>>> have a small form, but with bigger forms it is not very user 
>>>>>>>> friendly. Is there a way to avoid
>>>>>>>> this behaviour? Maybe a solution which includes anchoring or 
>>>>>>>> something like that?
>>>>>>>>
>>>>>>>> Thanks in advance
>>>>>>>>
>>>>>>>>
>>>>


Re: Refresh to top after submit() in dynamic form

Posted by AH Jaworski <an...@lostlemon.nl>.
Yes, but for accessibility reasons, the anchoring method would be in my 
favour.

Regards,

Antek

Op 23-2-2011 13:05, Bob Schellink schreef:
> Hi,
>
> Isn't easier to use JS to accomplish this? You could store the pageY offset and restore it when the
> page loads? jQuery or other JS libs might even have plugins for this.
>
> Kind regards
>
> Bob
>
> On 2011/02/23 13:56 PM, AH Jaworski wrote:
>> Yes, I think this would be the ideal solution, but the setActionURL() does not set the actionurl for
>> the already rendered form. After the submit the actionurl is updated, but then I need another
>> refresh to go to the anchor.
>>
>> Is there a way to override the actionurl of the form triggered by an onclick-action?
>>
>> Regards,
>> Antek
>>
>>
>> Op 22-2-2011 12:26, Axel Morgner schreef:
>>> Or as an alternative, try
>>>
>>>      myForm.setActionURL(myForm.getActionURL().concat("#anchor-123"));
>>>
>>> Axel
>>>
>>> On 22.02.2011 12:23, Axel Morgner wrote:
>>>> You're right.
>>>>
>>>> Is it an option for you to set the form action URL explicitely? E.g. like
>>>>
>>>>      myForm.setActionURL("my-page.htm#anchor-123");
>>>>
>>>> Greetings
>>>>
>>>> Axel
>>>>
>>>> On 22.02.2011 12:11, AH Jaworski wrote:
>>>>> But in the dynamic form the refresh gets initiated with: checkbox.setAttribute("onclick",
>>>>> "form.submit();");
>>>>>
>>>>> I don't think it's possible to give a parameter with the submit or is it?
>>>>> greets
>>>>> Antek
>>>>>
>>>>> Op 22-2-2011 12:03, Axel Morgner schreef:
>>>>>> Hi,
>>>>>>
>>>>>> good question. I've helped myself by adding something like that:
>>>>>>
>>>>>>      setRedirect(getRedirect().concat("#anchor-123"));
>>>>>>
>>>>>> I'm using anchors to set the active tab, together with jquery-tabs.
>>>>>>
>>>>>> Support for anchors in Click would be cool ...
>>>>>>
>>>>>> Greetings
>>>>>>
>>>>>> Axel
>>>>>>
>>>>>> On 22.02.2011 11:17, AH Jaworski wrote:
>>>>>>> Ive implemented a dynamic form as shown in the example:
>>>>>>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm
>>>>>>>
>>>>>>> After the submit takes place, you're redirected to the top of the page. This is good when you
>>>>>>> have a small form, but with bigger forms it is not very user friendly. Is there a way to avoid
>>>>>>> this behaviour? Maybe a solution which includes anchoring or something like that?
>>>>>>>
>>>>>>> Thanks in advance
>>>>>>>
>>>>>>>
>>>

Re: Refresh to top after submit() in dynamic form

Posted by Bob Schellink <sa...@gmail.com>.
Hi,

Isn't easier to use JS to accomplish this? You could store the pageY offset and restore it when the
page loads? jQuery or other JS libs might even have plugins for this.

Kind regards

Bob

On 2011/02/23 13:56 PM, AH Jaworski wrote:
> Yes, I think this would be the ideal solution, but the setActionURL() does not set the actionurl for
> the already rendered form. After the submit the actionurl is updated, but then I need another
> refresh to go to the anchor.
> 
> Is there a way to override the actionurl of the form triggered by an onclick-action?
> 
> Regards,
> Antek
> 
> 
> Op 22-2-2011 12:26, Axel Morgner schreef:
>> Or as an alternative, try
>>
>>     myForm.setActionURL(myForm.getActionURL().concat("#anchor-123"));
>>
>> Axel
>>
>> On 22.02.2011 12:23, Axel Morgner wrote:
>>> You're right.
>>>
>>> Is it an option for you to set the form action URL explicitely? E.g. like
>>>
>>>     myForm.setActionURL("my-page.htm#anchor-123");
>>>
>>> Greetings
>>>
>>> Axel
>>>
>>> On 22.02.2011 12:11, AH Jaworski wrote:
>>>> But in the dynamic form the refresh gets initiated with: checkbox.setAttribute("onclick",
>>>> "form.submit();");
>>>>
>>>> I don't think it's possible to give a parameter with the submit or is it?
>>>> greets
>>>> Antek
>>>>
>>>> Op 22-2-2011 12:03, Axel Morgner schreef:
>>>>> Hi,
>>>>>
>>>>> good question. I've helped myself by adding something like that:
>>>>>
>>>>>     setRedirect(getRedirect().concat("#anchor-123"));
>>>>>
>>>>> I'm using anchors to set the active tab, together with jquery-tabs.
>>>>>
>>>>> Support for anchors in Click would be cool ...
>>>>>
>>>>> Greetings
>>>>>
>>>>> Axel
>>>>>
>>>>> On 22.02.2011 11:17, AH Jaworski wrote:
>>>>>> Ive implemented a dynamic form as shown in the example:
>>>>>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm
>>>>>>
>>>>>> After the submit takes place, you're redirected to the top of the page. This is good when you
>>>>>> have a small form, but with bigger forms it is not very user friendly. Is there a way to avoid
>>>>>> this behaviour? Maybe a solution which includes anchoring or something like that?
>>>>>>
>>>>>> Thanks in advance
>>>>>>
>>>>>>
>>>>>
>>>
>>
>>


Re: Refresh to top after submit() in dynamic form

Posted by AH Jaworski <an...@lostlemon.nl>.
Yes, I think this would be the ideal solution, but the setActionURL() 
does not set the actionurl for the already rendered form. After the 
submit the actionurl is updated, but then I need another refresh to go 
to the anchor.

Is there a way to override the actionurl of the form triggered by an 
onclick-action?

Regards,
Antek


Op 22-2-2011 12:26, Axel Morgner schreef:
> Or as an alternative, try
>
> myForm.setActionURL(myForm.getActionURL().concat("#anchor-123"));
>
> Axel
>
> On 22.02.2011 12:23, Axel Morgner wrote:
>> You're right.
>>
>> Is it an option for you to set the form action URL explicitely? E.g. like
>>
>> myForm.setActionURL("my-page.htm#anchor-123");
>>
>> Greetings
>>
>> Axel
>>
>> On 22.02.2011 12:11, AH Jaworski wrote:
>>> But in the dynamic form the refresh gets initiated with: 
>>> checkbox.setAttribute("onclick", "form.submit();");
>>>
>>> I don't think it's possible to give a parameter with the submit or 
>>> is it?
>>> greets
>>> Antek
>>>
>>> Op 22-2-2011 12:03, Axel Morgner schreef:
>>>> Hi,
>>>>
>>>> good question. I've helped myself by adding something like that:
>>>>
>>>>     setRedirect(getRedirect().concat("#anchor-123"));
>>>>
>>>> I'm using anchors to set the active tab, together with jquery-tabs.
>>>>
>>>> Support for anchors in Click would be cool ...
>>>>
>>>> Greetings
>>>>
>>>> Axel
>>>>
>>>> On 22.02.2011 11:17, AH Jaworski wrote:
>>>>> Ive implemented a dynamic form as shown in the example: 
>>>>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm
>>>>>
>>>>> After the submit takes place, you're redirected to the top of the 
>>>>> page. This is good when you have a small form, but with bigger 
>>>>> forms it is not very user friendly. Is there a way to avoid this 
>>>>> behaviour? Maybe a solution which includes anchoring or something 
>>>>> like that?
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>>
>>>>
>>
>
>

Re: Refresh to top after submit() in dynamic form

Posted by Axel Morgner <ax...@morgner.de>.
Or as an alternative, try

myForm.setActionURL(myForm.getActionURL().concat("#anchor-123"));

Axel

On 22.02.2011 12:23, Axel Morgner wrote:
> You're right.
>
> Is it an option for you to set the form action URL explicitely? E.g. like
>
> myForm.setActionURL("my-page.htm#anchor-123");
>
> Greetings
>
> Axel
>
> On 22.02.2011 12:11, AH Jaworski wrote:
>> But in the dynamic form the refresh gets initiated with: 
>> checkbox.setAttribute("onclick", "form.submit();");
>>
>> I don't think it's possible to give a parameter with the submit or is it?
>> greets
>> Antek
>>
>> Op 22-2-2011 12:03, Axel Morgner schreef:
>>> Hi,
>>>
>>> good question. I've helped myself by adding something like that:
>>>
>>>     setRedirect(getRedirect().concat("#anchor-123"));
>>>
>>> I'm using anchors to set the active tab, together with jquery-tabs.
>>>
>>> Support for anchors in Click would be cool ...
>>>
>>> Greetings
>>>
>>> Axel
>>>
>>> On 22.02.2011 11:17, AH Jaworski wrote:
>>>> Ive implemented a dynamic form as shown in the example: 
>>>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm
>>>>
>>>> After the submit takes place, you're redirected to the top of the 
>>>> page. This is good when you have a small form, but with bigger 
>>>> forms it is not very user friendly. Is there a way to avoid this 
>>>> behaviour? Maybe a solution which includes anchoring or something 
>>>> like that?
>>>>
>>>> Thanks in advance
>>>>
>>>>
>>>
>



Re: Refresh to top after submit() in dynamic form

Posted by Axel Morgner <ax...@morgner.de>.
You're right.

Is it an option for you to set the form action URL explicitely? E.g. like

myForm.setActionURL("my-page.htm#anchor-123");

Greetings

Axel

On 22.02.2011 12:11, AH Jaworski wrote:
> But in the dynamic form the refresh gets initiated with: 
> checkbox.setAttribute("onclick", "form.submit();");
>
> I don't think it's possible to give a parameter with the submit or is it?
> greets
> Antek
>
> Op 22-2-2011 12:03, Axel Morgner schreef:
>> Hi,
>>
>> good question. I've helped myself by adding something like that:
>>
>>     setRedirect(getRedirect().concat("#anchor-123"));
>>
>> I'm using anchors to set the active tab, together with jquery-tabs.
>>
>> Support for anchors in Click would be cool ...
>>
>> Greetings
>>
>> Axel
>>
>> On 22.02.2011 11:17, AH Jaworski wrote:
>>> Ive implemented a dynamic form as shown in the example: 
>>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm
>>>
>>> After the submit takes place, you're redirected to the top of the 
>>> page. This is good when you have a small form, but with bigger forms 
>>> it is not very user friendly. Is there a way to avoid this 
>>> behaviour? Maybe a solution which includes anchoring or something 
>>> like that?
>>>
>>> Thanks in advance
>>>
>>>
>>


Re: Refresh to top after submit() in dynamic form

Posted by AH Jaworski <an...@lostlemon.nl>.
But in the dynamic form the refresh gets initiated with: 
checkbox.setAttribute("onclick", "form.submit();");

I don't think it's possible to give a parameter with the submit or is it?
greets
Antek

Op 22-2-2011 12:03, Axel Morgner schreef:
> Hi,
>
> good question. I've helped myself by adding something like that:
>
>     setRedirect(getRedirect().concat("#anchor-123"));
>
> I'm using anchors to set the active tab, together with jquery-tabs.
>
> Support for anchors in Click would be cool ...
>
> Greetings
>
> Axel
>
> On 22.02.2011 11:17, AH Jaworski wrote:
>> Ive implemented a dynamic form as shown in the example: 
>> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm
>>
>> After the submit takes place, you're redirected to the top of the 
>> page. This is good when you have a small form, but with bigger forms 
>> it is not very user friendly. Is there a way to avoid this behaviour? 
>> Maybe a solution which includes anchoring or something like that?
>>
>> Thanks in advance
>>
>>
>

Re: Refresh to top after submit() in dynamic form

Posted by Axel Morgner <ax...@morgner.de>.
Hi,

good question. I've helped myself by adding something like that:

     setRedirect(getRedirect().concat("#anchor-123"));

I'm using anchors to set the active tab, together with jquery-tabs.

Support for anchors in Click would be cool ...

Greetings

Axel

On 22.02.2011 11:17, AH Jaworski wrote:
> Ive implemented a dynamic form as shown in the example: 
> http://click.avoka.com/click-examples/form/dynamic/dynamic-form.htm
>
> After the submit takes place, you're redirected to the top of the 
> page. This is good when you have a small form, but with bigger forms 
> it is not very user friendly. Is there a way to avoid this behaviour? 
> Maybe a solution which includes anchoring or something like that?
>
> Thanks in advance
>
>