Skip to content

Commit

Permalink
Merge pull request #55 from IchHabRecht/selectbox-handling
Browse files Browse the repository at this point in the history
Enhance selectbox handling
  • Loading branch information
butu authored Mar 16, 2017
2 parents 0ac4780 + 3b645ea commit da1e335
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Classes/Utility/GeneralUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function getFirstNoneTabField($fields)
public function removeBlankOptions($haystack)
{
foreach ($haystack as $key => $value) {
if (is_array($value)) {
if (is_array($value) && $key !== 'items') {
$haystack[$key] = $this->removeBlankOptions($haystack[$key]);
}
if (empty($haystack[$key])) {
Expand Down
8 changes: 5 additions & 3 deletions Resources/Public/Scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,16 @@ jQuery(document).ready(function () {

// Checkbox items:
jQuery('.tx_mask_fieldcontent_items').each(function () {
var id = this.id;
itemArray = this.value.split('\n');
output = "";
jQuery.each(itemArray, function (key, line) {
lineArray = line.split(',');
output += '<input type="hidden" name="tx_mask_tools_maskmask[storage][tca][--index--][config][items][' + key + '][0]" value="' + lineArray[0] + '" />';
if (lineArray[1] !== undefined) {
output += '<input type="hidden" name="tx_mask_tools_maskmask[storage][tca][--index--][config][items][' + key + '][1]" value="' + lineArray[1].trim() + '" />';
}
if (id !== 'check_items') {
value = (lineArray[1] !== undefined) ? lineArray[1] : key.toString();
output += '<input type="hidden" name="tx_mask_tools_maskmask[storage][tca][--index--][config][items][' + key + '][1]" value="' + value.trim() + '" />';
}
});
jQuery(this).parent().find(".tx_mask_fieldcontent_itemsresult").html(output);
});
Expand Down

0 comments on commit da1e335

Please sign in to comment.