Bug #6961
Multiselect fields are not saved correctly.
| Status: | Accepted | Start date: | 2010-03-22 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | User registration | |||
| Target version: | 1.10.0 | Estimated time: | 2.00 hours | |
| Votes: | 0 |
Description
In my setup I have a custom field which consists of multiple checkboxes (For selecting FE_groups).
This returns an array of results, which mm_forum can't handle.
To fix this, the returned value has to be imploded to a comma separated string before saving to the DB. (In pi2 and pi5)
History
Updated by Martin Helmich about 3 years ago
- Status changed from New to Accepted
- Target version set to 1.10.0
- Estimated time set to 2.00
Updated by Peter Schuster almost 3 years ago
- Status changed from Accepted to Needs Feedback
Hi,
Could you provide your custom field configuration for testing?
That would simplify digging into this bug.
Peter
Updated by Peter Klein over 2 years ago
Here's the TS setup I use to extended MM Forum field.
This one displays a series of checkboxes, with data from the fe_groups, so that the FE user can select the FE group he/she wants to be a member of.
-- cut --
label = TEXT
label {
value = Temagrupper
}
input = COA
input {
// Save current value in register
10 = LOAD_REGISTER
10.fieldvalue.field = fieldvalue
// Create hidden input boxes for existing non-themagroups
20 = TEXT
// Default usergroup for new users = 58
// We need to set this here, as save will override the default group set in MM forum
20.value = 58
// But if a value already exists, use that instead. (Existing users)
20.override.field = fieldvalue
20.split {
token = ,
cObjNum = 1
1 {
10 = CONTENT
10 {
table = fe_groups
select {
pidInList = 1351
andWhere.dataWrap = uid={current:1} AND tx_sbnregional_istheme=0
}
renderObj = TEXT
renderObj.dataWrap = <input type="hidden" name="###USERFIELD_NAME###[]" value="{field:uid}" />
}
}
}
30 = CONTENT
30 {
table = fe_groups
select {
pidInList = 1351
where = tx_sbnregional_istheme=1
orderBy = title
}
renderObj = TEXT
renderObj {
insertData = 1
value = <input type="checkbox" name="###USERFIELD_NAME###[]" value="{field:uid}" />{field:title}<br />
override = <input type="checkbox" name="###USERFIELD_NAME###[]" value="{field:uid}" checked="checked" />{field:title}<br />
override.if.value.data = register:fieldvalue
override.if.isInList.field = uid
}
}
}
output = COA
output {
10 = TEXT
10.field = fieldvalue
10.wrap = <ul>|</ul>
10.required = 1
10.split {
token = ,
cObjNum = 1
1 {
10 = CONTENT
10 {
table = fe_groups
select {
pidInList = 1351
andWhere.dataWrap = uid={current:1} AND tx_sbnregional_istheme=1
orderBy = title
}
renderObj = TEXT
renderObj.field = title
renderObj.wrap = <li>|</li>
}
}
}
}
datasource = usergroup
-- cut --
Unfortunatly MM Forum doesn't support saving of multiple checkboxes, so you'll have to patch the source.
In line 352 of the file "class.tx_mmforum_pi2.php", insert this:
-- cut --
// Add support for multiselect checkboxes
if (is_array($value)) $value = implode(',',$value);
-- cut --
--
Peter Klein
Updated by Martin Helmich over 2 years ago
- Status changed from Needs Feedback to Accepted