Bruno17 / DynamicDropdownTV

13 stars 12 forks source link

Errors with modx 2.6.0 #9

Open wax100 opened 6 years ago

wax100 commented 6 years ago
  1. Do not save TV name after create because the name of TV "dynamicdropdown_multiple" is too long. Database field can store only 20 symbols.

  2. dynamicdropdown_multiple TV has not correct CSS (see attach)

  3. JS mistake Uncaught ReferenceError: $connector_path is not defined in

    core/components/dynamicdropdowntv/tv/input/tpl/dynamicdropdown.tpl
    core/components/dynamicdropdowntv/tv/input/tpl/dynamicdropdown_multiple.tpl
  4. If manually fix 1,2,3 and try to save TV with more than one value - in database we will see only one value.

  5. And after page reload we get empty field, so values do not render from DB

BazMaster commented 6 years ago

The problem is not solved yet. Multiple values are not stored or displayed in the TV.

BazMaster commented 6 years ago

@Bruno17 How to fix this error?

nicar commented 6 years ago

@wax100 @BazMaster see my commit above. Should be sufficient to just put those 4 files in the respective folders and then use the "dynamicdropdown_mlti" TV instead.

BazMaster commented 6 years ago

@nicar Thanks for help! Only the values are not loaded at the TV after a page reload!

nicar commented 6 years ago

@nicar Thanks for help! Only the values are not loaded at the TV after a page reload!

How many and what fields are you using? I only tested a "normal" dynamicdropdown TV in combination with one dynamicdropdown multi TV. I made some changes in my latest commit so it should work with at least two dddx-multi TVs.

https://github.com/nicar/DynamicDropdownTV/commit/4cdf3ccf8f3f8a0ad154dae538c24513e294610f

BazMaster commented 5 years ago

@nicar Hi! The values are still not loaded after the page is reloaded, despite changes in the files: https://file.modx.pro/files/5/d/4/5d4e9fc284412c26e1b8099a8c6ead3d.gif .

nicar commented 5 years ago

@BazMaster True, it worked only when using input Option values with direct input or bindings. A few changes to the getoptions will make it work. I already dit it at your install.

I will push the changes later to my repo.

in DynamicDropdownTV/core/components/dynamicdropdowntv/processors/mgr/default/getoptions.default.php replace line 72-76

if (!empty($query)) {
    $c->where(array($namefield . ':LIKE' => $query . '%'));
} else {
    $options[] = array('id' => '', 'name' => $firstText);
}

with

if (!empty($query)) {
    $tmp = explode('|', $query);
    $num = true;
    foreach($tmp as $t) {
        $num = ($num && is_numeric($t));
    }

    if($num) {
        $c->where(array($idfield . ':IN' => $tmp) );
    } else {
        $c->where(array($namefield . ':LIKE' => $query . '%'));
    }    
} else {
    $options[] = array('id' => '', 'name' => $firstText);
}
BazMaster commented 5 years ago

@nicar Perfect! You're the best! Thank you for fixing the add-on!