The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Page Control after Clicking Button, Need to stop page 'flying' back to top!
chome4
post Jun 7 2019, 12:14 PM
Post #1


Newbie
*

Group: Members
Posts: 11
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)
Attached File  template.zip ( 170.37k ) Number of downloads: 105
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 7 2019, 05:22 PM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,352
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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 8 2019, 02:17 PM
Post #3


.
********

Group: WDG Moderators
Posts: 8,206
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Jun 8 2019, 12:22 AM) *

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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 10 2019, 10:20 AM
Post #4


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,352
Joined: 9-August 06
Member No.: 6



QUOTE(Christian J @ Jun 8 2019, 09:17 PM) *

QUOTE(pandy @ Jun 8 2019, 12:22 AM) *

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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st August 2019 - 12:46 PM