Skip Navigation

[Resolved] adding space after a comma in a list

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by Christian Cox 5 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1315685

Tell us what you are trying to do?

On this page: hidden link
look at the Key Tenants Section the custom fields do not have a space after the comma.
Aldi Foods,Jo-Ann Fabric and Craft,Rooms and Rest

I would likethem to have a space

Aldi Foods, Jo-Ann Fabric and Craft, Rooms and Rest

Should the link on the dev site not display here is the live site
hidden link

We are using toolset.

I can provide ftp or the code if needed.

Thanks! -- Steven

#1315733

Hi, can you share the code that displays the custom field values? I'll review the syntax and let you know what we can do. Thanks!

#1315743

Thanks! for the reply

I think it might be related to this line in

jQuery('select[name=major-tenants] option:gt(0)').remove();

Here is the file
hidden link

It is around line 7664
function formatDropdowns(summary) {
// make everything unique
;
['states', 'manager', 'major-tenants', 'agent'].forEach(function (k) {
summary[k] = Array.from(new Set(summary[k].filter(Boolean)));
});
summary['states'].sort();
summary['manager'].sort();
summary['major-tenants'].sort();
summary['agent'].sort();
jQuery('select[name=state] option:gt(0)').remove();
jQuery('select[name=manager] option:gt(0)').remove();
// jQuery('select[name=major-tenants] option:gt(0)').remove();
jQuery('select[name=major-tenants] option:gt(0)').remove().append("XXX");
jQuery('select[name=agent] option:gt(0)').remove();
jQuery.each(summary['states'], function (key, value) {
jQuery('select[name=state]').append(jQuery('<option></option>').attr('value', value).text(value));
});
jQuery.each(summary['manager'], function (key, value) {
jQuery('select[name=manager]').append(jQuery('<option></option>').attr('value', value).text(value));
});
jQuery.each(summary['agent'], function (key, value) {
jQuery('select[name=agent]').append(jQuery('<option></option>').attr('value', value).text(value));
});
jQuery.each(summary['major-tenants'], function (key, value) {
jQuery('select[name=major-tenants]').append(jQuery('<option></option>').attr('value', value).text(value));
});
}

#1315749

Around Line 7611 there is this function

function styleTable(data) {
var tr = "<tr class='result'><td>' + data.name + '';
tr += parseInt(data.sqft) > 0 ? " <span style='color:#161616;'>(" + data.sqft + ' Sq. Ft.)</span>' : '';
tr += '<br />' + data.address + '</td>';
tr += '<td>' + data['sqft-available'] + ' Sq. Ft.<br />';
tr += data['num-available'] + '/' + data.units + ' Spaces</td><td style="text-align:center;">';
tr += data.outlot ? "<i style='color:#ccc;' class='icon-ok'></td>" : '</td>';
tr += '<td>' + data['major-tenants'] + '</td></tr>';
jQuery('#search-results').append(tr);
jQuery('#search-results').show();
}

I think the line
tr += '<td>' + data['major-tenants'] + '</td></tr>';

is outputting the information for the Key Tenants column in the table on
hidden link

I am not sure where the information for data['major-tenants'] file is coming from

#1315769

my first reply the talks about the dropdown summary was in the wrong place in the file.

#1315803

This seems to be custom JavaScript code written for use with Leaflet maps, and it's not supported by Toolset. With that being said, you can format the output of a JavaScript array using the JavaScript "join" function. I'm not sure if you can assume data['major-tenants'] will always be an array though. Do you know? If not, I strongly recommend asking whoever developed this custom code to provide a foolproof way to reformat the text shown here.