Choosing value on foreign fields.

Help
Anonymous
2012-07-09
2013-06-06

  • Anonymous
    2012-07-09

    I have two tables that use foreign keys:

    users -> stateId
    states -> id

    I can connect them with FK's and it's awesome, it's a dropdown… except that it's a dropdown of integers from 0-50 (including the null state).

    Unfortunately, this makes it impossible to use for humans, as they need to select the name, not the ID number.

    Additionally, on the table that displays all the values in the users table, the column shows the ID number;  again this is less than useful for humans.

    I'm pretty sure there has to be a way to make this value show instead of the FK Id number, but I've been unable to find it.

     

  • Anonymous
    2012-07-09

    I failed to mention;  I'm using Adminer Editor and it's almost awesome (I was dreading writing 50 pages that were just table CRUD), but unless the dropdown fields are a bit more user friendly I'm afraid I'll get mobbed by the admins.

     

  • Anonymous
    2012-07-09

    Also, how does the system decide what to show in edit fields?  On one database, going to the table listing shows the foreign key names (app->name), while going to the user table doesn't (it shows the ID number, not state->name).

     
  • Jakub Vrána
    Jakub Vrána
    2012-07-15

    The default behavior is to use first varchar column in the target table. If the table doesn't have such column then value is used itself. You can override this behavior by method rowDescription.