Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Page Control after Clicking Button

Posted by: chome4 Jun 7 2019, 12:14 PM

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: 282

Posted by: pandy Jun 7 2019, 05:22 PM

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.

Posted by: Christian J Jun 8 2019, 02: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>

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.

Posted by: pandy Jun 10 2019, 10:20 AM

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.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)