php - FormField for Varchar to a <select> + other as free text -
for standard varchar
(or text
) db field i'd replace set of fixed options - still allow "other" selected , user enter string of choice.
class mydataobject extends dataobject { static $db = array( 'myvarchar' => "varchar", ); function getcmsfields() { $fields = parent::getcmsfields(); $fields->replacefield( 'myvarchar', somefield( 'myvarchar', 'choose option or enter text', array(1 => 'option1',2 => 'option2') ) ); return $fields; } }
so i'm looking use somefield
, user see drop down values option1, option2 , other. if option1 or 2 selected saved myvarchar. if other selected allow specifying text directly of myvarchar normal.
i'm hopeful there is, in case of other answers i've received, pre-existing module this.
Comments
Post a Comment