1

Topic: Select_single fields and new options

Hi all,
  I'm trying to setup a Labstore installation (with some modifications that I'll make available once finished). I have a problem with the select_single fields (like the 'nature' field of the 'cell-lines' table). The problem is that when I try to type in a new value (one that is not present in the drop-down list of preset options) it is not saved the first time. When I add a record I can type the new value into the field, click save, but this value is not saved. I have to edit the entered records, type the new value into the field again and only then it gets saved. The values selected from the drop-down are saved the first time, it's only the new ones that are a problem. Any hints on how to solve this?
Pawel

2

Re: Select_single fields and new options

You are right, and there is a fix. The developer had mailed me about this a while ago. The correction has not been incorporated yet - maybe I will post a note on the forum.

Basically, you have to edit function insert_record in interface_creator/business_logic.php. Under "case 'select-single'" look for

$_POST[$field_name_temp] == "......"

and edit it to

$_POST[$field_name_temp] == ""

3

Re: Select_single fields and new options

Thank you, the fix works perfectly. Just as I was about to change all select_singles to textareas in desperation :-)

Another, much less urgent question (more like a feature request) - would it be very hard to modify the scripts so that when a new value is typed into a select_single field it is added to the option list for the future. Best - make it optional.
I believe it's just a question of appending the new string to the appropriate field in the dadabik_  table, but I'm too much a noob in PHP and SQL to try it myself for now.
Anyway - thank you for help, this is an excellent piece of software.
Pawel

4

Re: Select_single fields and new options

Actually, the feature to disable automatic update of options for select_single is there (enabling is through config.php: $autoupdate_options = 1;)  but currently is applicable only when updating records.

To pply when inserting records, edit interface_creator/business_logic.php, function insert_record -

Find
  udpate_options($fields_labels_ar[$i], $field_name_temp, $_POST[$field_name_other_temp]);

Change to
if (isset($autoupdate_options) and $autoupdate_options == '1'){
udpate_options($fields_labels_ar[$i], $field_name_temp, $_POST[$field_name_other_temp]);
}

("typo" in 'udpate' is not a typo!)

5

Re: Select_single fields and new options

Thank you! A nice update would be to add a new option only if it's not a duplicate of an existing one - I'll see if I can code this myself.

6

Re: Select_single fields and new options

Fixed in version 1.5.1