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.

and... i've found after...

https://github.com/leapfrognz/alternative-field

thank leapfrognz!


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -