Tuesday, 15 February 2011

joomla2.5 - Joomla 2.5 custom form field type -



joomla2.5 - Joomla 2.5 custom form field type -

i developing joomla component, , need custom form field type (joomla 2.5) in admin area, have problem... won't work. here done far:

file: /administrator/components/com_mycomponent/models/forms/history.xml

<form> <fields addfieldpath="/administrator/components/com_mycomponent/models/fields"> <field name="id" type="hidden" default="0" required="true" readonly="true"/> <field id="someid" name="someid" type="city" label="city" description="choose city" required="true" /> </fields> </form>

file: /administrator/components/com_mycomponent/models/fields/history.php

<?php defined('_jexec') or die('restricted access'); jimport('joomla.form.formfield'); class jformfieldcity extends jformfield { protected $type = 'city'; // getlabel() left out public function getinput() { homecoming '<select id="'.$this->id.'" name="'.$this->name.'"> <option value="1">city 1</option> </select>'; } }

and have changed. utilize tutorial: http://docs.joomla.org/creating_a_custom_form_field_type (it joomla 1.6, , cant find "fresh"). can tell me if need more code somewhere or wrong code?

edit: forgot mention code outputs input field.

seems file should have been named city.php, not history.php.

joomla joomla2.5 joomla-extensions

No comments:

Post a Comment