Dropdown list with changeable text field value

Explorer ,
Mar 05, 2020

Copy link to clipboard

Copied

Hi, please I have been searching for how to do the following but I have not been able to get any workable answer for the topic below, I have a field with its description by the side of it,

Now, I want the field description, which is by the side of it, to be a dropdown list, with selectable options, such that once a particular option of description is selected, it will affect the input result on the main field beside it.

 

For Example:

 

I have a list of:

| 1. Discount by amount

| 2. Discount by percentage

| 3. Outstanding amount.

 

If I select Discount by amount from the dropdown list as the description by the side of the text field; any amount I entered in the text field would be the discounted amount which will affect the “Due Amount” under it, by subtracting that entered discount amount from the “Due Amount”, if it is the Discount by percentage I selected on the dropdown as the text field description, any number I entered in the field would the percentage of the discounted amount, which will, in turn, affect the “Due Amount” by subtracting that percentage from the “Due Amount”  while if its Outstanding amount option I selected from the dropdown list, it means that the amount I will enter into the text field would be added to the supposed “Due Amount”

 

Picture:

dropdown list.JPG

Please i will really appreciate any assistance in the above illustration. Thanks

TOPICS
Acrobat SDK and JavaScript, Comment review and collaborate PDF, Create PDFs, How to, PDF forms, Standards and accessibility

Views

541

Likes

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

Dropdown list with changeable text field value

Explorer ,
Mar 05, 2020

Copy link to clipboard

Copied

Hi, please I have been searching for how to do the following but I have not been able to get any workable answer for the topic below, I have a field with its description by the side of it,

Now, I want the field description, which is by the side of it, to be a dropdown list, with selectable options, such that once a particular option of description is selected, it will affect the input result on the main field beside it.

 

For Example:

 

I have a list of:

| 1. Discount by amount

| 2. Discount by percentage

| 3. Outstanding amount.

 

If I select Discount by amount from the dropdown list as the description by the side of the text field; any amount I entered in the text field would be the discounted amount which will affect the “Due Amount” under it, by subtracting that entered discount amount from the “Due Amount”, if it is the Discount by percentage I selected on the dropdown as the text field description, any number I entered in the field would the percentage of the discounted amount, which will, in turn, affect the “Due Amount” by subtracting that percentage from the “Due Amount”  while if its Outstanding amount option I selected from the dropdown list, it means that the amount I will enter into the text field would be added to the supposed “Due Amount”

 

Picture:

dropdown list.JPG

Please i will really appreciate any assistance in the above illustration. Thanks

TOPICS
Acrobat SDK and JavaScript, Comment review and collaborate PDF, Create PDFs, How to, PDF forms, Standards and accessibility

Views

542

Likes

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
Mar 05, 2020 0
Adobe Community Professional ,
Mar 05, 2020

Copy link to clipboard

Copied

Here's an article on exactly this topic:

https://acrobatusers.com/tutorials/change_another_field/

 

 

Likes

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
Reply
Loading...
Mar 05, 2020 0
Explorer ,
Mar 05, 2020

Copy link to clipboard

Copied

Hi, Thom_Parker, i so much appreciate the work you did in the above link in breaking down those steps, but please can you provide me with a little assistant on how i can personalize that to my above illustration, am kind of new in this steps. Thank you.

--------------------------------------------------------------------------------------------------------------------------------------------------------

 

if you don't mind, i will also like to use this opportunity to ask your assistance on one of your earlier posts, https://acrobatusers.com/tutorials/formatting_text_fields/  on the custom currency symbol, in which you explained how to set the custom currency script, and you went further to give an example for pounds as follows: 

event.value = String.fromCharCode(0x0A3) + event.value;

i have now tried to use the same script by changing it to: 

event.value = String.fromCharCode(0x20A6) + event.value;

 for Naira currency symbol but all i kept getting is a circle like bullet sign, like the following:

 

Naira on Total.JPG

instead of this:

 

Naira.JPG

Likes

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
Reply
Loading...
Mar 05, 2020 0
Explorer ,
Mar 06, 2020

Copy link to clipboard

Copied

Hi, Thom_Parker, thank you, the Naira sign has worked now, i found out it works with selected fonts, in my case i had to use "Tahoma" font-type. However, there is one more thing here concerning that, please how can I introduce separator to the figures, instead of straight digits as it is now, I will like it to read as amount with commas, like N10,000.00 instead of N10000, please I need help to fix that. Thank you so much.

 

Separator.JPG

 

Also, i still need your help on the drop challenge i posted above, i will really appreciate the support, thank you so much.

Likes

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
Reply
Loading...
Mar 06, 2020 0
Explorer ,
Mar 06, 2020

Copy link to clipboard

Copied

Hi, Thom_Parker, thank you so much, the Naira sign and the separator has worked now perfectly, through the following script provided by "try67"  if (event.value) event.value = "\u20A6" + util.printf("%,0.2f", event.value);

 

 

correct_script.JPG

 

correct_separator.JPG

Likes

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
Reply
Loading...
Mar 06, 2020 0
Explorer ,
Mar 06, 2020

Copy link to clipboard

Copied

I am currently left with the drop list challenge, i will appreciate any breakdown support to get it done, thank you.

Likes

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
Reply
Loading...
Mar 06, 2020 0
Adobe Community Professional ,
Mar 10, 2020

Copy link to clipboard

Copied

Use the calculation script in the that will display the results of the dropdown.

 

var cDiscount = this.getField("DiscountDropdown").value;

switch(cDiscount)

 {

     case "Discount":

           event.value = ... ;

           break;

     case "Discount %":

           event.value = ... ;

           break;

     case "Outstanding":

           event.value = ... ;

           break;

     default:

           event.value = "";

           break;

}

 

Fill out the "..." with the value you want to appear in the text box

Likes

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
Reply
Loading...
Mar 10, 2020 0