Connecting Tech Pros Worldwide Help | Site Map

Return to location of change after page refresh/form submit

Member
 
Join Date: Mar 2008
Location: INDIA
Posts: 50
#1: May 5 '08
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
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: May 5 '08

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.
Member
 
Join Date: Mar 2008
Location: INDIA
Posts: 50
#3: May 7 '08

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()"/>
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: May 7 '08

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.
Member
 
Join Date: Mar 2008
Location: INDIA
Posts: 50
#5: May 26 '08

re: Return to location of change after page refresh/form submit


OK thanks............working hidden field logic
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#6: May 26 '08

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?
Member
 
Join Date: Mar 2008
Location: INDIA
Posts: 50
#7: May 27 '08

re: Return to location of change after page refresh/form submit


I mean it's working now ...sory 4 vauge communication
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#8: May 27 '08

re: Return to location of change after page refresh/form submit


No problem, glad to hear that you've got it working.
Reply