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

how to give an X a point value in text boxes

New Here ,
Sep 08, 2018 Sep 08, 2018

Copy link to clipboard

Copied

Good morning,

I am have set up a form containing two columns of text boxes (20 boxes in each column).  I have made an additional box at the bottom of each column for calculations where-in lies my problem.  I have set the text boxes to automatically put an X in each box by clicking on it, however I need to be able to assign a point value of 5 to each X in the first column and have it populate a score in the box at the bottom of the second column.  I would like the bottom box in the first column to calculate the total number of X's in the second column.  I have attached a section of the form to help explain what I'm trying to do.  I am very new to Adobe Acrobat and have little to no knowledge other than just playing around to figure things out, however this is eluding me.  Any help would be greatly appreciated. adobe.PNG

TOPICS
Acrobat SDK and JavaScript

Views

344

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
LEGEND ,
Sep 08, 2018 Sep 08, 2018

Copy link to clipboard

Copied

I would check boxes or radio buttons and assign an export value of 5 to the second column and 0 to the first column export value. Then you can just sum the value of the check box/radio button fields. For the "WRONG" field using the first calculation option of "Field is the sum of the following fields" and selecting the check boxes/radio buttons and then use the "Simplified field notation" to calculate the "TOTAL" field by subtracting the "#WRONG" field from 100. Also I would not use a symbol as the first character of a field name. I would also rename the second column form the "NG#" to "G#", that will make the check boxes/radio buttons act in a mutually exclusive manner.

There many free tutorials about creating forms free ftom Adobe and you should watch/read them.

.

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
Explorer ,
Sep 13, 2018 Sep 13, 2018

Copy link to clipboard

Copied

LATEST

The value in TOTAL may be computed incrementally, based on each change in the value of the G*. The value in #WRONG may be computed incrementally, based on each change in the value of NG*. The change may be brought about by a field event such as MouseUp or Blur. For example if G0 changes from ‘’ to ‘X’ then 5 is added to the value of TOTAL, and if G1 changes from ‘X’ to ‘’ then 5 is subtracted from the value of TOTAL. Here is an example codes for the MouseUp event for text fields G* and NG* respectively

switch(event.target.value) {
  case 'X':
    event.target.value = '';
    this.getField('TOTAL').value -= 5;
    break;
  case '':
    event.target.value = 'X';
    this.getField('TOTAL').value += 5;
    break;
  default:
    event.target.value = 'X';
    this.getField('TOTAL').value += 5;
  break;
}

switch(event.target.value) {
  case 'X':
    event.target.value = '';
    this.getField('#WRONG').value -= 1;
    break;
  case '':
    event.target.value = 'X';
    this.getField('#WRONG').value += 1;
    break;
  default:
    event.target.value = 'X';
    this.getField('#WRONG').value += 1;
    break;
}

The document "Computing Sums Incrementally and Automatically" is a reply to your question with more details. It contains three sample form applications: the first uses text fields for G* and NG* and attaches the code above as a MouseUp event to every text field, the second uses text fields for (G* and NG*) and attaches the code above as an OnBlur event to every text field, and the third uses button fields for G* and NG* and attaches code similar to the above code as a MouseUp event ot every button field.

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