Copy link to clipboard
Copied
Hi,
I wanted to create a text field that will automatically add a strikethrough to whatever text is typed in. I currently have a custom format script set as:
event.value = "$"+event.value
,which allows a dollar sign to be placed at the beginning of whatever the user is typing, but I couldn't figure out how to automatically add a strikethrough. If someone can help with this simple inquiry, it'd be much appreciated!
Copy link to clipboard
Copied
In text field properties under options tab, tick 'Allow rich text formatting' and use this code:
If you want to strikethrough dollar sign:
var str = event.value;
if(event.value){
var spans = new Array();
spans[0] = new Object();
spans[0].text = "$"+str;
spans[0].strikethrough = true;
event.richValue = spans;}
If you don't want to strikethrough dollar sign:
var str = event.value;
if(event.value){
var spans = new Array();
spans[0] = new Object();
spans[0].text = "$";
spans[1] = new Object();
spans[1].text = str;
spans[1].strikethrough = true;
event.richValue = spans;}
If you want space after dollar sign replace "$" with "$ ".
Copy link to clipboard
Copied
Do you want to strikethrough dollar sign also or just typed value?
Copy link to clipboard
Copied
In text field properties under options tab, tick 'Allow rich text formatting' and use this code:
If you want to strikethrough dollar sign:
var str = event.value;
if(event.value){
var spans = new Array();
spans[0] = new Object();
spans[0].text = "$"+str;
spans[0].strikethrough = true;
event.richValue = spans;}
If you don't want to strikethrough dollar sign:
var str = event.value;
if(event.value){
var spans = new Array();
spans[0] = new Object();
spans[0].text = "$";
spans[1] = new Object();
spans[1].text = str;
spans[1].strikethrough = true;
event.richValue = spans;}
If you want space after dollar sign replace "$" with "$ ".
Copy link to clipboard
Copied
Thank you, that worked exactly as I hoped. Just one more thing - is there a way to make the strikethrough line thicker? -

