How about http://www.silverstripe.org/asm-multi-select-field-module/ ?
I haven't tried it, but I'd be interested in your results
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- 2
- Page 33(current)
- 4
- Next 10 entries
I love this module, but I always have to hack it to work with belongs_many_many.
When you say hack away at it, do you mean because you get bad responses with Asmselectfield like
ERROR [User Warning]: DataObject::get_by_id passed a non-numeric ID #1,2,3
IN POST /admin/EditForm
Line 2924 in /var/www/vhosts/mysite/httpdocs/sapphire/core/model/DataObject.php
I've got multiselectfield working, but I get bad responses only when I switch to AsmselectField.
Asmselectfield works overall if I only select one member in the dropdown.
Hi,
i checked the asm Module. (didnt have time earlier)
But this module also gives you a dropdownlist for each available entry.
When I tried it with my 50.000+ enries table, firefox almost crushed.
I had to click "dont´t stop the script" then finally i got the complete list.
$WDL = DataObject::get('WDL');
$asmfield = new AsmselectField('WDL','WDL',$WDL);
In this case an ajax-search would be the only solution, i guess
Hi, i unfortunately i have got the same problem as grapicator. Can anybody help?
Hi, i think the problem is, that function add($item, $extraFields = null) from ComponentSet (line 119) can't handle arrays? Can anybody help to work around?
500//ERROR [User Warning]: DataObject::get_by_id passed a non-numeric ID #1,2
IN POST /admin/EditForm
Line 2924 in /xx/sapphire/core/model/DataObject.php
Source
======
2915: $tableClasses = ClassInfo::dataClassesFor($callerClass);
2916: $baseClass = array_shift($tableClasses);
2917: return DataObject::get_one($callerClass,"\"$baseClass\".\"ID\" = $id", $cache);
2918:
2919: // This simpler code will be used by non-DataObject classes that implement DataObjectInterface
2920: } else {
2921: return DataObject::get_one($callerClass,"\"ID\" = $id", $cache);
2922: }
2923: } else {
* 2924: user_error("DataObject::get_by_id passed a non-numeric ID #$id", E_USER_WARNING);
2925: }
2926: }
2927:
2928: /**
2929: * Get the name of the base table for this object
2930: */
Trace
=====
<ul>user_error(DataObject::get_by_id passed a non-numeric ID #1,2,512)
line 2924 of DataObject.php
DataObject::get_by_id(Banner,1,2)
line 119 of ComponentSet.php
ComponentSet->add(1,2)
line 191 of ComponentSet.php
ComponentSet->setByIDList(Array)
line 116 of AsmselectField.php
AsmselectField->saveInto(Page)
line 1021 of Form.php
Hi,
i faced another issue.
I am using the MultiSelectField in modeladmin.
Everythings looks fine but not in case of validation.
As you know the modeladmin can use getCMSValidator()
The good news is, that my own validation module (NetefxValidator) is working with MultiSelectField.
So i can show validation messages like "you have to choose at least 5 items".
Thats fine.
But there is another strange thing.
The chosen items are not correct after an validation error.
Sometimes there is an item missing, next time 2 more items are chosen or any other unexpexted selection ?!?
it would be very nice if you can fix that, because we definitly need validation in CMS.
With this bug we have to use the CheckboxSetField.
thanks in advance
I think i got it working in case of a validation error in modeladmin.
The MultiSelectField remembers its selected items.
The funny thing about it is, that i didnt understand what the methode getSelected() is doing in case of !$value.
So i commented it all out :) because it was causing trouble when no item was selected before.
/**
* Get array of selected IDs
*/
public function getSelected() {
$value = $this->value;
// --- uncommenting: Start ---
// If value not set, try to get it from the form
/*
if (!$value && is_object($this->form)) {
$record = $this->form->getRecord();
if ($record && $record->hasMethod($this->name)) {
$methodName = $this->name;
$join = $record->$methodName();
if ($join) {
foreach ($join as $joinItem) {
$value[] = $joinItem->ID;
}
}
}
}
*/
// --- uncommenting: End ---
return $value;
}
Also in case of validation the selected items are returned as a string.
So in line 40 i inserted:
// in case of validation we get the selected items as a string, so we have to make an array of it multiselectfield can work with
// --- Start ---
if (!is_array($value)) {
$arr_value = explode(",", $value);
$value = array();
foreach($arr_value AS $v) {
$value[$v] = (int)$v;
}
}
// --- End ---
It seems to work fine.
But commenting so many lines out, lets me think, these line might be needed :)
Maybe you can use this approach to make a better fix.
regards
lx
- Previous 10 entries
- 1
- 2
- Page 33(current)
- 4
- Next 10 entries