469,270 Members | 1,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Return to location of change after page refresh/form submit

48
need logic so when the page is refreshed that it returns to the location
of the change, not to the top of the page.
Currently, when the page is refreshed, it takes you back to the
beginning of thepage, not the area you may be working on.
What we need the page to do is when enter or tab is pressed and the
page refreshes, take you back to the exact spot on the page you were
at when you pressed enter.when each refresh form submition take place..couls any one plz help?is javascript s help?
May 5 '08 #1

✓ answered by acoder

I can think of at least two ways to do this:

1. You can create a named link, e.g. <a name="text1"> next to each text box, then the form action can be changed to "actionpage.cfm#text1", to jump to the position on the page. You can set this using JavaScript in the onchange.

2. Use a hidden field and change it onchange. When the form is submitted, you can write Coldfusion code to take the hidden field value which is the name of the text box which triggered the update and jump to that position.

Note: you don't need "javascript:" in an onchange, just the JavaScript code itself is sufficient.

Hope that helps. Let me know if you need help implementing this.

7 9797
acoder
16,027 Expert Mod 8TB
You can use either JavaScript or plain HTML, though you could set it via Coldfusion.

Can I confirm one or two things though: is the refresh via a form submission? Is this triggered by pressing tab or enter?

Post some code, so it can be easier to suggest changes/additions.
May 5 '08 #2
CF FAN
48
we using " onchange="javascript:document.form.submit()" in onchange.What i wants is that when i changed somthing in text field thn form submition took place.
a lot of controls in the form.large form..so when a change somthing in textbox then after submition the control will come to tht changed posion.not the focus in tht form control..just show the postion

<input name="text1" type="text" value="#text1#" id="text1" size="15" maxlength="13" onchange="javascript:document.form.submit()"/>
May 7 '08 #3
acoder
16,027 Expert Mod 8TB
I can think of at least two ways to do this:

1. You can create a named link, e.g. <a name="text1"> next to each text box, then the form action can be changed to "actionpage.cfm#text1", to jump to the position on the page. You can set this using JavaScript in the onchange.

2. Use a hidden field and change it onchange. When the form is submitted, you can write Coldfusion code to take the hidden field value which is the name of the text box which triggered the update and jump to that position.

Note: you don't need "javascript:" in an onchange, just the JavaScript code itself is sufficient.

Hope that helps. Let me know if you need help implementing this.
May 7 '08 #4
CF FAN
48
OK thanks............working hidden field logic
May 26 '08 #5
acoder
16,027 Expert Mod 8TB
Do you mean you've got it working or you're going to work with the hidden field option?
May 26 '08 #6
CF FAN
48
I mean it's working now ...sory 4 vauge communication
May 27 '08 #7
acoder
16,027 Expert Mod 8TB
No problem, glad to hear that you've got it working.
May 27 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

19 posts views Thread by gsb | last post: by
3 posts views Thread by Anthony | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.