Solution - Multiple select menu/checkbox

alpha2zee

Well-known member
I have not tested the modifications in DaDaBik 4.0 alpha. But I can confirm that the multiple select menus work (with both dictated options and foreign tables) in 3.2.

You are right about that typo in the function name in my 10.03-05 post. There is another typo in there - the cases should be so

case "select_multiple":
case "select_multiple_checkbox":

and not 'select_multiple_menu'.

Would that possibly be the cause?
 

Shadow44

New member
Fantastic! I seem to have it working ... you got me on the right track, though I can't be sure what I've done is 100% correct ...

In business_logic.php I found 3 occurrences of:

case "select_multiple":

All of which I changed to:

case "select_multiple_menu":

For reference, this is v4.0 alpha, and they were at line#s 690, 1881, 2000.

Then I re-tried it, but it didn't work, this time only outputting plain text "Choose ..." where the menu should be. So I checked further and in business_logic.php I found 8 occurrences of:

"select_multiple"

All of which were being tested against the type_field. My logic then was that v4.0 alpha doesn't seem to use any such type, so I changed all of those to:

"select_multiple_menu"

And so far it seems to work fine. I'll post again if I find any wrinkles.

Many thanks for your help, and this great mod.
 

Shadow44

New member
Not sure if this is a feature or a bug :)

Posting it here to possibly help someone
else implementing this mod ...

When using multiple possible values for a
field, those values cannot be two words
separated by a space or other punctuation.
If they are, the values are not correctly
stored on your database.

For example:

If one of your values is entered as
"~White Shirt~", then it is stored on
the database as "~White Shirt" with the
end delimter missing. The result seems
to be that it display okay, but you can
not search on that value - it will not
be found. Using "~Wite-Shirt~" also
failed for me, but "~WhiteShirt~" is
fine.
 

alpha2zee

Well-known member
The multiple selection feature was implemented in DaDaBik 2 and then disabled. But Eugenio had left the code in 3.2 and that's what I had worked on. The 'multiple_select' term was used to mean 'multiple_select_menu' and left it so. Thus, either everything needs to be 'multiple_select' or 'multiple_select_menu,' including the entries in ENUM values in the dadabik_ internal tables. (DaDaBik 4, using the adoDB system, obviously does not directly set ENUM.)

The bug you notice ('white shirt') appears to be version 4-specific as I do not see it in 3.2.
 

Shadow44

New member
Hi - me again,

Having a little bug I can't quite pin down ..

When adding a record, and making multiple choices for a field, sometimes only one selected value makes it to the database.

Mostly it works fine, but this bug happens if I click on one value somewhere down the list, and then Ctl-click on other values further up the list. Only the uppermost value survives.

My field is a mutli-menu, alphanumeric, max length= 200, separator= ~, currently 29 options to include.

Thanks as always for any help!
 

Shadow44

New member
Good point ... was using Firefox, just tried IE and the answer is "maybe" ...

With IE, *none* of the selected options made it to the database. (Firefox captured 1 of 3).

I can recreate this bug at will now, but I guess that won't help too much due to my specific setup. Any details I could provide?
 

Shadow44

New member
Sorry again, my bad - this bug is not being consitent like I thought ...

It will happen/not happen with both FF & IE :(
 

Shadow44

New member
I believe I now have one clue ...

The dropped-multi-option bug only happens if any duplicate records are found.

Something must be screwing up the count of multi options present i.e.:

$count_temp_2 = count($_POST[$fields_labels_ar[$i]["name_field"]]);

in business_logic.php

OR possibly emptying all but one option i.e.:

if (!(empty($_POST[$field_name_temp][$j])))



Post Edited (12-01-05 18:39)
 

alpha2zee

Well-known member
What do you mean by 'duplicate records'? Is it that the problem happens with duplicate-checking enabled and during record insertion after the 'possible duplication warning' phase?
 

alpha2zee

Well-known member
Can you look at the HTML source of the form that you get with the 'insert anyway,' etc., buttons? Are the hidden inputs there with all the selected options?
 

Shadow44

New member
Here is the "insert anyway" form ... hopefully this displays ok ..

<form action="index.php?table_name=plugins&function=insert&insert_duplication=1" method="post"><input type="hidden" name="Developer" value=""><input type="hidden" name="Plugin" value="Test Plugin 2"><input type="hidden" name="Format[0]" value="VSTi"><input type="hidden" name="Platform[0]" value="Win"><input type="hidden" name="Version" value=""><input type="hidden" name="Type[0]" value="Rompler"><input type="hidden" name="Rating" value=""><input type="hidden" name="Description" value=""><input type="hidden" name="Issues" value=""><input type="hidden" name="Cost" value=""><input type="hidden" name="Link" value=""><input class="button_form" type="submit" value="Insert anyway"></form>

It's this that is wrong:

<input type="hidden" name="Type[0]" value="Rompler">

There were 3 options selected, and only one, "Rompler" survives.

Plus I just noticed that the only other multi-choice field I have is wrong too:

<input type="hidden" name="Format[0]" value="VSTi">

2 options were selected, 1 survives.



Post Edited (12-02-05 04:51)
 

alpha2zee

Well-known member
I think this was the cause -
[pre]
if (isset($_POST[$field_name_temp])){
$count_temp_2 = count($$field_name_temp);
[/pre]
The double-dollar issue was noted in another of your thread, but we didn't see the missing $_POST as in
[pre]
if (isset($_POST[$field_name_temp])){
$count_temp_2 = count($_POST[$field_name_temp]);
[/pre]

added to earlier 'instruction' post in this thread and to the Sourceforge post



Post Edited (12-02-05 16:40)
 

Shadow44

New member
Excellent work! Multiple options is functioning perfectly now.

I cannot thank you enough for your skills and willingness to lend support.
 

newuser

New member
Alpha2zee,

Thanks for all your work on this. One question, which I think is the root of some displaying troubles I have had (fields show up correctly in the update form, but not in the details section or in the "Show All" table, in which fields that are full appear to be missing, while other values have shifted into the incorrect columns. I have v.3.2, but point 3A on your list of things to modify is commented out in my version. Should I comment out the other create_internal_table function, and activate the one with the ENUM field definitions? Thanks.
 

Shadow44

New member
@ alpha2zee or others:

Can you help me understand DaDaBIK's search function when the field being searched is a Multiple select menu/checkbox?

I'm hoping to improve my search to offer the option of OR-ing or AND-ing the values in such a field. I notice that right now, the search select for such fields is hardcoded with AND (re: function build_where_clause in business_logic.php).

I assume there are difficulties in porperly formatting a select statement that may have ANDs and Ors?

On a related note, why, in the same function, are the field values compared using LIKE? I tried using = but it doesn't return anything.

Thanks for any advice.
 

tom

New member
If I change the table to user_tab I only see a half page without any records only the information "3 records found" but not the records itself. The script creates only a part of the html code and end with:
<span class="n_results_found"><br />1 records found</span>
</body>, no </html> are missing

I'm using the modifide interface creater code from 25.12.05.

what's wrong?
tom
 
Top