5093 Posts in 1516 Topics by 1113 members
| Go to End | ||
| Author | Topic: | 2371 Views |
-
Re: New Admin Module

24 September 2010 at 11:35am
I created a CustomTextField and these includes work:
<?php
class CustomTextField extends TextField {
function __construct($name, $title = null, $value = "", $maxLength = null, $form = null){
$this->include_js($name);
parent::__construct($name, $title, $value, $maxLength, $form);
}
public static function include_js($name){
Requirements::javascript('productadmin/testcode/test.js'); // <--- works
}
function Field() {
$attributes = array(
'type' => 'text',
'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''),
'id' => $this->id(),
'name' => $this->Name(),
'value' => $this->Value(),
'tabindex' => $this->getTabIndex(),
'maxlength' => ($this->maxLength) ? $this->maxLength : null,
'size' => ($this->maxLength) ? min( $this->maxLength, 30 ) : null
);
if($this->disabled) $attributes['disabled'] = 'disabled';
Requirements::javascript('productadmin/testcode/test.js'); // <--- works
return $this->createTag('input', $attributes);
}
}The customScript in Field() does not work, but neither in ModelAdmin:
Requirements::customScript("var test = 'test';", 'UniqueID');
| 2371 Views | ||
| Go to Top |

