Jump to content

Numbered List


dfalkowitz

Recommended Posts

Hello!

 

I was hoping someone would be able to help me create a numbered list within a Fusion Pro Javascript Rule?

 

Sample HTML:

<ol>

<li>test1</li>

<li>test2</li>

</ol>

 

Fusion Pro Output:

1. test1

2. test2

 

Is there a way to produce the FP Output within a Rule?

 

Thank you!

Link to comment
Share on other sites

There are a number of ways to create a numbered list in FusionPro and none of them require HTML. I'm going to assume you're trying to accomplish something more complicated than the example you gave so I'll ignore the "why don't you just type the numbers in the text editor window" elephant in the room.

 

Perhaps you have several fields that represent list items but you only want them to appear in the list if they have a value:

var list = [
 Field("ListItem1"),
 Field("ListItem2"),
 Field("ListItem3")
];

return list.filter(String).map(function(s,p){
 return p + 1 + '. ' + s; 
}).join('<br>');

 

Or maybe you just want each item's indent to line up in the event that the text wraps. If that the case, you don't need a rule at all. Check out this thread: http://forums.pti.com/showthread.php?t=4075

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...