Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Return to location of change after page refresh/form submit

Question posted by: CF FAN (Member) on May 5th, 2008 07:24 AM
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?
acoder's Avatar
acoder
Site Moderator
11,618 Posts
May 5th, 2008
10:37 AM
#2

Re: Return to location of change after page refresh/form submit
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.

Reply
CF FAN's Avatar
CF FAN
Member
50 Posts
May 7th, 2008
10:27 AM
#3

Re: Return to location of change after page refresh/form submit
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()"/>

Reply
acoder's Avatar
acoder
Site Moderator
11,618 Posts
May 7th, 2008
11:01 AM
#4

Re: Return to location of change after page refresh/form submit
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.

Reply
CF FAN's Avatar
CF FAN
Member
50 Posts
May 26th, 2008
10:30 AM
#5

Re: Return to location of change after page refresh/form submit
OK thanks............working hidden field logic

Reply
acoder's Avatar
acoder
Site Moderator
11,618 Posts
May 26th, 2008
11:23 AM
#6

Re: Return to location of change after page refresh/form submit
Do you mean you've got it working or you're going to work with the hidden field option?

Reply
CF FAN's Avatar
CF FAN
Member
50 Posts
May 27th, 2008
06:35 AM
#7

Re: Return to location of change after page refresh/form submit
I mean it's working now ...sory 4 vauge communication

Reply
acoder's Avatar
acoder
Site Moderator
11,618 Posts
May 27th, 2008
07:45 AM
#8

Re: Return to location of change after page refresh/form submit
No problem, glad to hear that you've got it working.

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,798 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Coldfusion Forum Contributors