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

Need multiple Simplified Field Notations

Community Beginner ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

I have a form that I need three different Simplified Field Notations. How do I do that?

TOPICS
General troubleshooting

Views

2.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

correct answers 1 Correct answer

Community Expert , Oct 04, 2017 Oct 04, 2017

Use this code:

var a = Number(this.getField("M1").valueAsString);

var b = Number(this.getField("T1").valueAsString);

var c = Number(this.getField("A1").valueAsString);

if (c!= 0) {

  event.value=(a+b)/c;

} else {

  event.value = "";

}

Votes

Translate

Translate
Community Expert ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

For different fields? Just apply each calculation differently. It shouldn't be a problem.

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 Beginner ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

I tried but it keeps writing over the first one.

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 ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

Did you copy and paste the field? If so, you need to rename the copies so they have a unique name. Otherwise, they will remain exact copies of each other.

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 Beginner ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

These are the two different ones. Does Locking the field make a difference?

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 ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

No, it's only preventing you from editing it...

Those screenshots don't show that the fields are actually named differently.

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 Beginner ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

The fields being:

Mealevent2 + tipevent2/AttendeesEvent2  This being the first Scripts

and

Refreshments+tip/Ateendees  this being the second Script.

Are these not different enough?

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 ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

Can you share the file in question (via Dropbox, for example)?

On Wed, Oct 4, 2017 at 12:09 AM, beverlyh81967728 <forums_noreply@adobe.com>

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
LEGEND ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

Those are the calculations, not the names. What are the names?

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 Beginner ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

Those are the names of the fields.

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
LEGEND ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

Maybe that's the problem. Try giving them normal names (letters and numbers only)

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 Beginner ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

Will do. Let you know tomorrow if it makes any difference. Thank you for your help.

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 Beginner ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

Well that worked but now I'm getting the Java script error that the value entered does not match the field that has the division in it. From what I've seen on the web if the field is blank or 0 I'm going to get this error unless I can write a custom calculation script. Have you done that? I just need field 1 ("M1") + field 2 ("T1") / field 3 ("A1")

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 ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

This happens when you try to divide by zero (or an empty value). You can't

use the Simple Field Notation if that's the case. You must write a custom

calculation script.

On Wed, Oct 4, 2017 at 8:04 PM, beverlyh81967728 <forums_noreply@adobe.com>

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 Beginner ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

Can you help with that? I saw on another post one that you worked on but of course it doesn't work specially with mine. I'm close but it doesn't pick up the two fields needing to be added before the division.

var a =this.getField("M1");

var b =this.getField("T1");

var c =this.getField("A1");

if(a.value != 0)

{

  // perform division;

   event.value=((a.value+b.value)/(c.value))

} else {

  // do not divide by zero;

   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
Community Expert ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

You're almost there, you're just checking the wrong variable... It's "c" that must not be zero, not "a".

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 Beginner ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

I made that change but it's still not calculating correcting.

Attendees (A1)=2

Meals (M1)=100.00

tip(T1)=5.00

Cost per person=502.50 should be 52.50

The formula works if I take out the tip.

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 ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

Use this code:

var a = Number(this.getField("M1").valueAsString);

var b = Number(this.getField("T1").valueAsString);

var c = Number(this.getField("A1").valueAsString);

if (c!= 0) {

  event.value=(a+b)/c;

} 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
Community Beginner ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

Yes!! That worked. You are amazing! OK why didn't the other one work?

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 ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

Because you didn't explicitly converting the values to numbers (as I did), they were being treated as strings and concatenated, instead of added up.

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 Beginner ,
Oct 04, 2017 Oct 04, 2017

Copy link to clipboard

Copied

LATEST

Thank You, Thank You!. One little field cost me a full day but with your help made it all worth it. Thanks again.

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