I am looking for an appropriate method of obtaining the ID of a newly created form element. For example, in a typical module we might have something like this:
Code: Select all
$smarty->assign('comment_input', $this->CreateTextarea(false, $id, '', 'comment_body', '', $id.'comment_body', '', '', '', ''));
Code: Select all
<textarea name="cntnt01comment_body" cols="" rows="" class="cms_textarea" id="cntnt01comment_body"></textarea>
Code: Select all
$bbcode_toolbar = $this->BBCode->BBCToolbar($id.'comment_body');
Am I doing something wrong? Is there a better way of doing it? Or can I simply hardcode it like $this->BBCode->BBCToolbar("cntnt01comment_body"); ?
Any help appreciated.

EDIT: ahem. Seems I've managed to figure it out myself afterall. The way I wrote the BBCToolbar function assumed that the only parameter it receives is an array ($params['input']), whereas it was actually receiving one variable containing a string. I changed it to use "$input" instead and it's working fine now. But if there's more of a "proper" way than simply using $id.'whatever', I'd like to know
