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

Using check box in formula

New Here ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

Hello,

 

I need help creating a Java script when using checkbox

 

for example

when "CB1" is checked I need "LST" to  = $600

when "CB2" is checked I need "LST" to = $750

when "CB3" is checked I need "LST" to = $800

when "CB4" is checked I need "LST" to = $900

when "CB5" is checked I need "LST" to = $1100


Thanks

 

 

Views

77

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 ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">

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 ,
22 hours ago 22 hours ago

Copy link to clipboard

Copied

What should happen if multiple checkboxes are checked, do you want to sum the result in that case?

If you don't want to sum the result, which checkbox should take precedence?

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 ,
7 hours ago 7 hours ago

Copy link to clipboard

Copied

Good question....

this is for an order form and in theory only 1 box would need to be checked as the quanity/price gradually increases in each checked box option.

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 ,
25m ago 25m ago

Copy link to clipboard

Copied

LATEST

You can use this in a text field where you want to show price as 'Custom calculation script':

var price = [600, 750, 800, 900, 1100];

for(var i=1; i<=5; i++){
var cb = this.getField("CB"+i).valueAsString;
if(cb !== "Off"){
 event.value = price[i-1];
 break;}
else
 event.value = "";}

Although this should work for you, if only one checkbox should be checked at a time, consider using solution posted by try67.

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 ,
21 hours ago 21 hours ago

Copy link to clipboard

Copied

If you only want one value to be selectable out of the group then give all fields the same name (for example, "CB"), but unique export values (the value should be just a number, without the dollar symbol).

Then you could use a simple script for populating the selected value into a text field:

 

var cb = this.getField("CB").valueAsString;

if (cb!="Off") event.value = cb;

else event.value = "";

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