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

Combining multiple field entries into one field with random Number

Community Beginner ,
Mar 08, 2022 Mar 08, 2022

Hello Everyone I am new in this field so sorry for my bad code. I have a form where i would like to generate the Random Numbers with reference. I have a dropdownlist what I need is when I select any data from list/or select any checkbox it should generate a random number with reference under Ref Field:

For Example if I select Information Management & checked International from Check Box it should give a result in Ref Box Like”INTL-IM-1234567890”.
 
Any kind of support will be appreciated
 
This is the script which i have tried:
var v1 = this.getField("CheckBox1").value.checked;
if (this.getField("CheckBox1").value=("DOM")
var v2 = this.getField("CheckBox2").value.checked;
if (this.getField("CheckBox2").value ("INTL")
var v3 = this.getField("Data_Type").value;
if (v3 =="Information Management") {
event.value = "IM";
}
else if (v3 =="Data Management") {
event.value = "DM";
}
else if (v3 =="Collection Management") {
event.value = "CM";
}
if (this.getField("Ref").value == "")
this.getField("Ref").value = v1- + v2- + v3- +(Math.floor(Math.random()*Math.pow(10,10)));
 
screen.png
 
TOPICS
How to , JavaScript , PDF forms
1.0K
Translate
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Mar 09, 2022 Mar 09, 2022

You can use this as a calculation script:

( See attachment, I edited the checkboxes and the dropdown export values.)

 

if (this.getField("Check Box1").value != "Off") {v1 = this.getField("Check Box1").value + "-";}
else {v1 = "";}
if (this.getField("Check Box2").value != "Off") {v2 = this.getField("Check Box2").value + "-";}
else {v2 = "";}
if (this.getField("Data_Type").value != this.getField("Data_Type").defaultValue) {v3 = this.getField("Data_Type").value + "-";}
else {v3 = "";}

if (v1 == "" && v2 == "" && v3 == "") {event.target.value = "";}
else {event.target.value = v1 + v2 + v3 + (Math.floor(Math.random()*Math.pow(10,10)));}


Acrobate du PDF, InDesigner et Photoshopographe

View solution in original post

Translate
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 ,
Mar 16, 2022 Mar 16, 2022
LATEST

Search "Options tab for form field properties : Drop-down and list box" in this page: https://helpx.adobe.com/acrobat/using/pdf-form-field-properties.html


Acrobate du PDF, InDesigner et Photoshopographe

View solution in original post

Translate
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 ,
Mar 09, 2022 Mar 09, 2022

You can use this as a calculation script:

( See attachment, I edited the checkboxes and the dropdown export values.)

 

if (this.getField("Check Box1").value != "Off") {v1 = this.getField("Check Box1").value + "-";}
else {v1 = "";}
if (this.getField("Check Box2").value != "Off") {v2 = this.getField("Check Box2").value + "-";}
else {v2 = "";}
if (this.getField("Data_Type").value != this.getField("Data_Type").defaultValue) {v3 = this.getField("Data_Type").value + "-";}
else {v3 = "";}

if (v1 == "" && v2 == "" && v3 == "") {event.target.value = "";}
else {event.target.value = v1 + v2 + v3 + (Math.floor(Math.random()*Math.pow(10,10)));}


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 Beginner ,
Mar 09, 2022 Mar 09, 2022

Thank you so much, As i expected its working perfectly.

Translate
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 Beginner ,
Mar 09, 2022 Mar 09, 2022

Can you please advice me about how to change dropdown export values.

Translate
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 ,
Mar 16, 2022 Mar 16, 2022
LATEST

Search "Options tab for form field properties : Drop-down and list box" in this page: https://helpx.adobe.com/acrobat/using/pdf-form-field-properties.html


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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