Page Control after Clicking Button, Need to stop page 'flying' back to top! |
Page Control after Clicking Button, Need to stop page 'flying' back to top! |
chome4 |
Jun 7 2019, 12:14 PM
Post
#1
|
Newbie Group: Members Posts: 19 Joined: 6-April 16 Member No.: 24,129 |
Got this template:
https://www.free-css.com/free-css-templates/page192/owl When you click 'Contact', the page moves the relevant section. After the form is filled-in and 'Sent' is cliked, the page goes back to Home. I want the page to remain in view. I think it's a Javascript issue. Can anyone enlighten me on this? I've tried to used inspect but can't work it out. Hope someone can help. Thanks in advance. Attached File(s) template.zip ( 170.37k ) Number of downloads: 283 |
pandy |
Jun 7 2019, 05:22 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
It doesn't matter what happens now when you submit the form. When the page goes live you need a server side script to handle the form and that script should also handle what happens after the form is submitted.
If you don't have a URL to a script as the value of the action attribute the form will submit to the current page. That's why it looks like the page scrolls to the top. Actually, there is a hash sign as the value of action, but that doesn't help. But as said, the script you'll use later should handle what happens after the form is submitted. |
Christian J |
Jun 8 2019, 02:17 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,658 Joined: 10-August 06 Member No.: 7 |
If you don't have a URL to a script as the value of the action attribute the form will submit to the current page. That's why it looks like the page scrolls to the top. Actually, there is a hash sign as the value of action, but that doesn't help. Perhaps the hash could point to an ID close to the submit button: CODE <form action="#foo"> ... <input type="Submit" id="foo"> </form> but then the new page might still start at the top for a split second before scrolling down. Or you might submit the form to another page in an iframe: CODE <iframe name="script.php"></iframe> <form action="script.php" target="foo"> ... <input type="Submit"> </form> but then any confirmation message should be created in the framed page script.php. |
pandy |
Jun 10 2019, 10:20 AM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,731 Joined: 9-August 06 Member No.: 6 |
If you don't have a URL to a script as the value of the action attribute the form will submit to the current page. That's why it looks like the page scrolls to the top. Actually, there is a hash sign as the value of action, but that doesn't help. Perhaps the hash could point to an ID close to the submit button: CODE <form action="#foo"> ... <input type="Submit" id="foo"> </form> I did try that with the id the form already has, but for some reason it doesn't work. But it doesn't matter since the form won't be used as it is now. |
Lo-Fi Version | Time is now: 26th April 2024 - 02:41 PM |