You are viewing limited content. For full access, please sign in.

Question

Question

Form- JavaScript scroll function working in preview, but not when one starts the actual process

asked on January 22, 2020

  $(".cf-section-block").click(function() {
   $('html,body').animate({ scrollTop:$(this).parent().next().offset().top}, 'slow');});

 

I have this function to scroll to the top of the section when it is opened based on a radio button and field rule.  This works in preview mode, but does not work when the process is actually started by a user. 

 

Can anyone help with this?

0 0

Replies

replied on January 22, 2020

Hello,

When you say it is not working within the actual process, are you referring to a starting form, or a form that is part of a user task?

The reason I ask is that a user task is contained within a parent frame, which will impact which elements are retrieved by the $('html,body') selector.

0 0
replied on January 22, 2020

Hello,

Referring to the starting form. When testing in preview mode it works.  But when a user goes to start the process script does not work. 

 

Thank you,

0 0
replied on January 22, 2020

Okay, but to clarify, is this a published form being accessed via the published URL, or are they clicking the "Start Process" button from within Forms?

0 0
replied on January 22, 2020

They can log-in to forms and click "start" to start the process or click the link we have.

Either way, the script to scroll to the section does not work. 

0 0
replied on January 22, 2020

Are there any JavaScript errors showing up? If you load the page and open the browser dev tools you should be able to determine if it isn't running at all or if it is throwing an error.

0 0
replied on January 22, 2020

Hello Amberly,

This sounds really cool. Would you mind elaborating on how to implement this a little? I have a basic understanding of JavaScript and am always looking for new things to try.

TIA

Jonathan

0 0
replied on February 16, 2021

Hi, 

I am having the same issue, My java Script works on preview but doesn't when I start the process.

I have a JavaScript code to Check a checkbox once something has been uploaded, when I do this on preview it works fine but on start it doesn't work.

My code attached below.

Thank you.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.