sandigcustomprinters.com Posted October 26, 2015 Share Posted October 26, 2015 I need to split a multi-line text field into an array based on the line break as the delimiter. I have tried: var data = Field("BenefitsList"); var eachLine = data.split(/\n/g); and other regular expressions to no avail. Does anyone know how to split on a line break in a multi-line text field? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 26, 2015 Share Posted October 26, 2015 I need to split a multi-line text field into an array based on the line break as the delimiter. I have tried: var data = Field("BenefitsList"); var eachLine = data.split(/\n/g); and other regular expressions to no avail. Does anyone know how to split on a line break in a multi-line text field? What does the original data look like? Can you post the data file here? Also, is this a data file being generated by a web-to-print system such as MarcomCentral? Quote Link to comment Share on other sites More sharing options...
sandigcustomprinters.com Posted October 26, 2015 Author Share Posted October 26, 2015 The input data is being generated by Marcom Central. The user is entering their information into the field as I try to show on attached screen shot. I attached the FP file and my sample data. I do not know a way to test multi-line fields within Fusion Pro. I am using RULE_insertBenefitBullet to create an array based on the line breaks, but marcom central is not recognizing the '<br>'. We have uploaded the files using other regular expressions with \r and \n trying to get the delimiter. None have been successful yet. I do not know what delimiter to look for in the multi-line field. Your help is much appreciated, Dan.FP files.zip Quote Link to comment Share on other sites More sharing options...
sandigcustomprinters.com Posted October 26, 2015 Author Share Posted October 26, 2015 here is the screen shotuser input multiline.png.zip Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 26, 2015 Share Posted October 26, 2015 The input data is being generated by Marcom Central. Then this is a MarcomCentral-specific question. (It's specific to how MarcomCentral generates data from its multi-line text editor, as opposed to how another web app might generate something similar, or to what someone might generically refer to as multi-line input.) Therefore, if you ask your question in the MarcomCentral forum, or contact your CPM, you'll have a better chance that someone who knows more about MarcomCentral will see it. The user is entering their information into the field as I try to show on attached screen shot. I attached the FP file and my sample data. I do not know a way to test multi-line fields within Fusion Pro. We need to find out exactly what are the contents of the data field in the data file that MarcomCentral is generating. Try making a rule that returns that field, but withOUT the "Treat returned strings as tagged text" box checked, and typeset that rule into the output. Then we should see the actual raw field value in the output. Quote Link to comment Share on other sites More sharing options...
step Posted October 26, 2015 Share Posted October 26, 2015 I imagine it has something to do with how FP/MarcomCentral is interpreting tagged text. As in, maybe the break tags themselves (<br>) in your data are being converted to HTML entities: <br> This is a sort of "catch all" regex that will replace a variety of page breaks with "<br>" and then create an array by splitting on the "<br>": return Field("BenefitsList").replace(/<p>|\r|\n|<br>|<p>/g,'<br>').split('<br>'); Quote Link to comment Share on other sites More sharing options...
sandigcustomprinters.com Posted October 26, 2015 Author Share Posted October 26, 2015 Ste, that worked!!! THANK YOU SO MUCH!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.