Skip Navigation

[Resolved] After submitting, page scrolls down to form top

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by Luo Yang 7 years ago.

Assisted by: Luo Yang.

Author
Posts
#593650

I am trying to:
Submit a contact form and have it refresh with a message (or just the same form stays displayed).

Link to a page where the issue can be seen:
hidden link

I expected to see:
After submitting the form, I expected to see a "thanks" message. The page should be refreshed and no scrolling should happen.

Instead, I got:

The "thanks" message but the page scrolls down a bit, I think to the top of the cred form perhaps. The URL ends up like this:

hidden link

Could it be due to the #cred_form_70_1 in the URL? Why is that there?

#593792

Dear brentC,

You are right, it is due to the #cred_form_70_1 in the URL, that is a HTML anchor:
hidden link

So when you submit the CRED form successfully, the browser will be able to scroll to the CRED form location.

#593990

Is it possible to prevent this behavior?

I have a CSS fixed header panel at the top of my site (which is probably a common thing) and so when it scrolls the actual "thanks for contacting us" message gets hidden behind the panel... This happens on pages where there is lots of text below the form so scrolling is possible (note: this only happens when logged in so you can't easily see it on the example link but it happens for me and you can probably imagine how that would happen on any site with lots of content below the form).

#593997

I thought of using the "redirect to another page" option to solve this but my site is in two languages so I can't easily pick a static page. I also tried the "AJAX submission" but it still redirects afterward. I also tried "keep displaying this form" and same issue. Is there any way to cleanly resolve this?

#594222

There isn't such a built-in feature within CRED form, if you agree, we can take it as a feature request, our developers will evaluate it.

#594223

Yes, definitely a feature request please.

Any ideas on the best way to deal with this in the meantime? It is a really weird experience right now... Worst case I'd have to duplicate the form and specify a specific redirect page for each language in my two-language site.

Or, I guess I could redirect them to the submitted post with a "thank" message at the top of that page, but I didn't really want to make the post public (although I guess if I could make the URL something random like a GUID that might be ok - security through obscurity).

#594237

The HTML anchor is added in CRED plugin file cred-frontend-editor\application\models\form\post.php, line 117:

$url = $url . '#cred_form_' . $prg_id;

You can simply commend it to:

//$url = $url . '#cred_form_' . $prg_id;
#594351

Ok, thanks, but that would get overwritten on the next update of CRED, right? Any way to do it in a more maintainable way?

#594556

Yes, it will be overwritten, it is only a temporary workaround.

As I mentioned above there isn't such a built-in feature within CRED form
https://toolset.com/forums/topic/after-submitting-page-scrolls-down-to-form-top/#post-594222
And I have filed it as a feature request, our developers will evaluate it.