Extra commas from blank fields after concentate

New Here ,
Jan 16, 2021 Jan 16, 2021

Copy link to clipboard

Copied

Hello.  I have a form with these fields:  title1, series1, section1, desc1. There are 5 sets.  This data is combine into a multi line text box that reads as such "title1 series1 section 1 desc1, title2 series2 section2 desc2..." contuing through 5.  Between the sets there is a comma. My problem is that it's not always all 5 sets.  So after the fields are combined and if it's say only 2 sets, I get this "title1 series1 section1 desc1, title2 series2 section2 desc2, , , ,". I'm using event.value = this.getfield("title1").valueasstring etc

 

Is there a way to get rid of all the extra commas?

TOPICS
JavaScript

Views

47

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 16, 2021 Jan 16, 2021

Copy link to clipboard

Copied

Yes, there's a way to do that. It would be very helpful if you posted the entire and exact script that you're currently using.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Jan 17, 2021 Jan 17, 2021

Copy link to clipboard

Copied

LATEST

Add the values into an array, if they are not empty. Then use the join method to convert the array to a single, comma-delimited string and apply it as the field's value.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines