Jump to content

Specific Bullet List Formatting


juliemartin

Recommended Posts

I have a client that has a specific way in which their bullet points are to be formatted.

 

Example:

:: Bullet :: Bullet :: Bullet

 

Each bullet must have the 2 colons and space in front.

 

Is there anyway to send an error note or automatically reformat them if the user doesn't follow this format?

 

Please help! :)

Link to comment
Share on other sites

It might be necessary to see a sampling of your data to see what kind of input should be expected, but I think the following code should cover most scenarios:

//Replace "YOUR_FIELD" with name of your field (3x)
//search for first instance of alphanumeric character (A-Z, a-z, 0-9) and returns index
var TrashCharsLength = Field("YOUR_FIELD").search(/\w/);

//determine length of field and subtract number of characters preceding "live" data 
var TextLength = Len(Field("YOUR_FIELD"));
var CleanedData = Right(Field(YOUR_FIELD), TextLength - TrashCharsLength);

//add correct "prefix" to "clean" data
var BulletedText = ":: " + CleanedData;

return BulletedText;

Link to comment
Share on other sites

Thank you - this is very close to what I need!

 

Next question: This coding changes the bullet format for the first entry to :: but the user is allowed to enter multiple bullets within the same field and I need the format to be changed in front of each one, not just the first.

 

Do I need to use separate fields for each bullet point and apply this rule?

 

Example:

:: Strength - Agility - Plyometrics

Link to comment
Share on other sites

Do I need to use separate fields for each bullet point and apply this rule?

 

Example:

:: Strength - Agility - Plyometrics

I was under the impression that each bullet was it's own field.

 

While we can use JS to replace a string of characters with another (i.e. swap " - " with ":: ") I don't know that we can account for all the possible scenarios that a user might choose to enter his data.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...