title: Drupal - dynamic options for text_list field
body: <p>I have a custom node type for which I want to have a field that uses a special combobox based on <code>list_text</code>. When one chooses the type <code>list_text</code> it is normally possible to enter a static list of selectable texts, however, I want this list to be dynamic, i.e. based on the results of a <code>db_query</code>. What is the best way to do this using Drupal 7?</p>
  
  <p>A simple example for clarification: A node of this custom type X contains a field that points to another node, so whenever a node of type X is created I want a combobox that contains all other nodes.</p>
  
  <p>(Best solution would be to only display the combobox during node creation, and no longer during edit. But I could also live with it if the combobox was shown during the edit as well.)</p>
  
  <p>I have tried to customize <code>options_select</code> by defining my own data type and implementing <code>hook_options_list</code> accordingly. The combobox was displayed during creation with the correct values, however,  I could not save it.. I have no idea what went wrong there, but on the first submit it would change to a different theme, and when I tried again I got an internal server error. Am I on the right track at all with defining a completely new data type for the field? there surely must be a simpler way?</p>