How to pass field parameter to customCode button calling javascript

i am trying to create a button in DetailView that calls a javascript.
This javascript, then calls(ajax) a custom Controller action to retrieve some data.
To do this the javascript function needs to have as input the id of record.

I’ve tried this without luck:

function display()
        $this->dv->defs['templateMeta']['form']['buttons'][101] = array (
            'customCode' => '<input title="Activate" accesskey="{$APP.LBL_PRINT_PDF_BUTTON_KEY}" class="button" onClick="javascript:activate({$});" name="activate" value="Activate" type="button">');

The returned error putting {$} as input is:
Uncaught SyntaxError: identifier starts immediately after numeric literal

How can i pass id of field into javascript funcion?

Many thanks

You need to surround {$} with quotes:


It works like a charm!