meeting-room-booking-system / mrbs-code

MRBS application code
Other
127 stars 62 forks source link

Custom entry dropdown field not showing or saving #1673

Open jberanek opened 8 years ago

jberanek commented 8 years ago

Hi,

I added a dropdown for mrbs_entry and mrbs_repeat called flight_instructor

I used $select_options['entry.flight_instructor'] = array('Flight Instructor 1','Flight Instructor 2', 'Flight Instructor 3'); to make it a dropdown in the add_entry.

The issue I'm having it that all thats coming up when I look at the entry is "Flight Instructor: F", as opposed to what I'm trying for, which is "Flight Instructor: Flight Instrucor 1","Flight Instructor: Flight Instrucor 2", etc

It's appearing as F for all 3 options when I view the entry.

Also, the option I pick between instructor 1,2 and 3 dont seem to be saving. When I go to edit entry, it's always set back to the first on, no matter when if i set it to 2 or 3.

Any help greatly appreciated

Reported by: *anonymous

Original Ticket: mrbs/support-requests/949

jberanek commented 8 years ago

Which version of MRBS are you using?

And what's the type of the column you created in the entry and repeat tables?

Original comment by: campbell-m

jberanek commented 8 years ago

It sounds like you have a CHAR(1) ora VARCHAR(1) instead of VARCHAR(30) or whatever.

Original comment by: campbell-m

jberanek commented 8 years ago

Sorry for the delay. Yes, that solved it, thanks. I had it set to CHAR(1) as that's how the default type is stored. Thanks again.

Original comment by: *anonymous

jberanek commented 8 years ago

The other way of doing it is to keep the CHAR(1) and use an associative array, eg

$select_options['entry.flight_instructor'] = array(
    'A' => 'Flight Instructor 1',
    'B' => 'Flight Instructor 2', 
    'C' => 'Flight Instructor 3');

(Note that this won't work with integers for the keys). This gives you a bit more flexibity because you can change the description without changing the entries in the database. For example you could rename 'Flight Instructor 1' to 'John' but keep 'A' as the key in the database.

Original comment by: campbell-m