• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

strikethrough text field based on radio button status using java script

New Here ,
Jan 21, 2016 Jan 21, 2016

Copy link to clipboard

Copied

Hello,

I've searched high and low for the answer but nothing I've tried worked. I have a form in which one of the text field, called TotalCreditAmount, calculates total credit based on the amounts from the table's fields. The java script used for this calculation under "Custom calculation script" is as follows (formula derived with help found in this forum...credit given):

(function () {

    // Get the input field values, as strings

    var s1 = getField("Credit AmountRow1").valueAsString;

    var s2 = getField("Credit AmountRow2").valueAsString;

    var s3 = getField("Credit AmountRow3").valueAsString;

    var s4 = getField("Credit AmountRow4").valueAsString;

    // Convert strings to numbers

    var v1 = +s1;

    var v2 = +s2;

    var v3 = +s3;

    var v4 = +s4;

    // If either input field is not blank, calculate the sum...

    if (s1 || s2 || s3 || s4) {

        event.value = (v1 + v2 + v3 + v4);

    } else

event.value = "";  // ...otherwise, set blank the field

})();

I have two radio buttons under name "TypeofReturn" with Radio Button Choice "Choice2" and "Choice3".

QUESTION:

Where and what kind of java script would I need to implement in order to STRIKETHROUGH the total amount calculated in the field "TotalCreditAmount"?


I've tried following:

NOTE: The code was added to the "Custom calculation script" of the "TotalCreditAmount" text field before the calculate function.

1. event.target.required = getField("TypeofReturn").valueAsString === "Choice2"; I know this only changes field to "required" but I though this could somehow also work with strikethrough command..... Also when I added another line with "Choice3" in it it would only activate "required" with only one radio button "Choice3" and the other one would do nothing.


2. I've tried working with examples from Adobe java SDK as follows:

var f = this.getField("TotalCreditAmount");

f.richText = true;

f.textColor = color.blue;

f.strikethrough = true;

I wanted to know if it works at all so I've added color change. It does change the color but it does not strikethrough anything...


...help...


TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 21, 2016 Jan 21, 2016

Copy link to clipboard

Copied

strikethrough is not a property of text fields.


You can use strikethrough at text spans.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 21, 2016 Jan 21, 2016

Copy link to clipboard

Copied

Hi Bernd,

I saw SPANS in the Adobe JavaScript API but was not sure on their usage and implementation. Do you have working example or place I can read more about it...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 21, 2016 Jan 21, 2016

Copy link to clipboard

Copied

LATEST

‌Look at the Acrobat Javascript Reference. The is example for the use of the property underline.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines