Radio button script that will insert script in text field if 'yes' radio button selected.



I'm building a form with a text field for which I'd like to give end users the option to bullet the text they've entered.

While ES4 allows captions to be bulletted, end users don't have that option even if the field format is rich text. I discovered a work around using the script below for the text field's exit action.

//value of the field to insert "• " in each line

var sFldValue = this.rawValue;

//you split text in field for each '\r' = newLines made with enter

var tmpFldArray = sFldValue.split("\r");

//tmp string you concat your out text in

var sOutStr = "";

//for each line of text insert '• ' in beginning

for(var i = 0; i < tmpFldArray.length; i++){

//need to add '\r' because split removed it

sOutStr += "• " + tmpFldArray[i] + "\r";


//return manipulated string to your field

this.rawValue = sOutStr;

Issues I'd like to fix about this script:

  1. A new set of bullets are inserted upon each exit
  2. Lines aren't indented.

The end user may not want their entered text to be bulletted so I need a script for the radio buttons that will insert the bullet script above into the text field's exit action if 'yes' is selected and remove it if 'no' is selected.

Accepted Solutions (0)

Answers (0)