Hi, i would like to code my own custom tv input type. I created input controller and template like
hinted in the docs here. I created a TV with based on this and linked it to my template.
I don’t want to use ExtJS. So I tried including jquery. Now if I edit a page, which has that tv, I keep getting the javascript error ’$ is not defined’.
My controller
<?php
$this->xpdo->lexicon->load('tv_widget');
return $this->xpdo->smarty->fetch('element/tv/renders/input/geobird.tpl');
?>
My template
<script src="ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
alert('**' + $('tvnametest').val());
});
</script>
<input id="tvnametest" class="textfield" value="test1" />
I also tried putting this at the start of my controller without success
$modx->regClientStartupHTMLBlock('
<script src="ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>');
EDIT : I even tried using ExtJS since everything else failed. Using this template:
<script type="text/javascript">
// <![CDATA[
{literal}
Ext.getCmp('tvnametest').setValue("289");
//{/literal} ]]>
</script>
<input id="tvnametest" class="textfield" value="test1" />
Still no luck. I get "Ext.getCmp("tvnametest") is undefined".