Home › Toolset Professional Support › [Resolved] Message instead of form toolset scroll to top JS
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Related documentation:
This topic contains 3 replies, has 3 voices.
Last updated by rubenB 5 years, 5 months ago.
Assisted by: Christian Cox.
Hi,
i set up CRED FORM that user will see message instead of form toolset, but my problem is that the message after submit form shows in the top part of the page and user have to scroll up to find this message.
I´m trying to use JS to get to the top of the page after click on submit button, but i can not figure out... could you please help me?
CRED FORM
<div class="row"> <div class="col-sm-12"> <center>[cred_field field='form_submit' output='bootstrap' value='Potvrdit zveřejnění' class='button' id='odeslani']</center> </div> </div>
Messega after submit
<div id="zprava"><i class="fa fa-check-circle" style="color:green"></i><a style="font-size:16px; font-family:quicksand; font-weight:500; color:green"> Děkujeme za odeslání!</a></div>
JS
jQuery(document).on('click','.form_submit', function() { $('html, body').animate({ scrollTop: 0 }, 'slow'); });
Hi, unfortunately there is no public JavaScript API for interacting with Forms events. If your Form submits with AJAX, that means the code to trigger this animation event is not supported or provided here in the forums. The 'click' event on a submit button cannot be used to trigger code like this. However, if your Form submits by reloading the page, you can use the Forms Redirection PHP API to add some URL parameter to the redirect URL, then use custom JavaScript to respond to that URL parameter upon page load. I can show you examples of the PHP redirection approach if you are interested. The API documentation is available here: https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
My issue is resolved now by Post saved message as a alert near submit button. Thank you!
HI Jakub could you explain how did you solve this issue?
I would also like the 'Post Saved Message to appear near the submit button.
Thanks for any ideas or tips!