Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8507101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:46:26+00:00 2026-06-11T02:46:26+00:00

Ok, so I have a template which I am using to print a couple

  • 0

Ok, so I have a template which I am using to print a couple of users to a table.

function PrintUsers(item) {
    $.template('userList', '<tr onClick="OnUserPressed(${Identifier})">\
    <td>${Firstname}</td>\
    <td>${Lastname}</td>\
    </tr>');

    $.tmpl('userList', item).appendTo("#UserTableContainer");
}

When I press a user I want his/hers unique identifier to be passed to a function called OnUserPressed which I am declaring in the template. The code below is just a test to see if it actually passes the data to the function.

    function OnUserPressed(Identifier) {
        alert(Identifier);
    }

My problems are these: When I press the first value in the table I get “Uncaught SyntaxError: Unexpected token ILLEGAL”. When I press any other value in the table I get “Uncaught ReferenceError: xxx is not defined” where xxx is their unique identifier. So it actually retrieves the ID but I still get an error.

Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:46:27+00:00Added an answer on June 11, 2026 at 2:46 am

    You probably need to pass the identifier to the OnUserPressed function as a string.

    Try wrapping the ${Identifier} template variable with single quotes:

    <tr onClick="OnUserPressed('${Identifier}')">
    

    Edit: Responding to comment about single quotes.

    Inside your template string you can escape the single quotes by preceeding them with a backslash:

    '<tr onClick="OnUserPressed(\'${Identifier}\')">'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have template in which a button is created with a link using css,
I have a velocity template which has a nested table. I want to align
I have a button inside of a nestedlist's item template which when the user
I've got a problem with using django's {% trans %} template function. I have
Say I have a template which displays a view based on a property: {{#if
I am migrating application from JSF1.2/MyFaces+Facelets TO JSF2.1/MyFaces. I have following template which used
I have a file template.txt which contains the following: Hello ${something} I would like
I have an e-mail template which is just a plain, static HTML page. I
I have a custom magento template which im trying to tweak and just have
something driver me crazy here i have a big HTML template which i can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.