Problem with Onclick Javascript in Template field

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.


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

Can someone help me to debug this?

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?


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

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].

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.

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!!

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

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