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

Question

Question

Custom button is not working with JS on new Forms upgrade

asked on September 16, 2024

Hi Team, 

 

We have added a button fromusing Advanced HTML with the below code. 

<input type="button" value="Refresh" onclick="Test();" />

and have written a function Test() { console.log("ttt")}; 

However the above code is not working in both the below scenarios,

  1. From External Script
  2. Also from JS code section

 

Appreciate your help on this.

0 0

Replies

replied on September 17, 2024

If this is using the new designer, you will want to have the function declaration explicitly defined on the window object. Like so:
 

window.Test = function() { console.log("ttt")}; 

 

1 0
replied on September 19, 2024

Hi,

 

We tried this exact snippet but still we are getting an error. Have attached the screenshot.

0 0
replied on September 19, 2024

Are you on the latest version of Forms? 11 update 5?

0 0
replied on September 20, 2024

We are on version 11, attaching the exact one below

0 0
replied on September 24, 2024

Ah, yes this feature was added in update 5 (11.0.2311.50564)

0 0
replied on September 24, 2024

Is there any workaround for getting this to work in the current version we are in ?

0 0
replied on September 24, 2024 Show version history

Unfortunately none that wouldn't break when you update to update 5 and beyond. There was a significant amount of enhancements done to the new designer in update 5 so I definitely recommend updating if you can.

0 0
replied on September 16, 2024

Are you using the Classic Designer or the modern Forms Layout Designer? JavaScript changed dramatically with the new designer.

0 0
replied on September 18, 2024

Yes, we are using the new forms designer and facing this issue. The older one seems fine.

0 0
replied on September 18, 2024 Show version history

Try Zachary's suggestion, JavaScript is sandboxed in the new designer, so things have to be done in a very different way.

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

Sign in to reply to this post.