Skip to main content
Nintex Community Menu Bar
Question

Problem with Onclick Javascript in Template field

  • July 10, 2024
  • 7 replies
  • 54 views

Forum|alt.badge.img+4

I have created one Template field in table. Below is the code. But the code is not working properly. i have set the value of allow HTML to true.

{{Alert_Message__c}}

I am getting only first alert(alert(‘Hiiii0’)😉 , but then it just dont work.

Can someone help me to debug this?

7 replies

Forum|alt.badge.img+4

After investigation i found that Skuid does not recognize $ sign for jQuery. Hence i have used jQuery now .

var $ = skuid.jQuery, args = arguments[0],item = args.item,list = args.list,model = args.model;

but now i am not getting any value in arguments[0].

Can somebody help to resolve this out?


Forum|alt.badge.img+18

Sumeet,

What is the goal here? Why write your own scripts inside a template instead of just defining a javascript snippet in the pagebuilder?


Forum|alt.badge.img+4

Hi Matt, I even tried that like calling JavaScript snippet in my html template using skuid.snippet.getSnippet(‘snippetName’)(); But still I’m not getting anything in arguments[0].


Forum|alt.badge.img+18

What’s the use case? Why do you need to call a snippet from a template component?

Does your template component have a model assigned? It may just be that you have no context for skuid to send to the arguments.


Forum|alt.badge.img+4

I want to perform some operation on click of field in my model. So I put that field value in template and called on click function in HTML template. The template is inside table only and table is assigned by model of custom object. Do I need to assign model to my template if yes , how? Thanks for quick response!!


Forum|alt.badge.img+4

you can see the main question body to know what I am actually doing and how my code look like.


Forum|alt.badge.img+18

Instead of putting your field in a template, use a custom field renderer. There you can add a onclick function to field.element.