Stringabfrage

New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

Hallo zusammen,
hätte mal eine Frage,

A =this.getField("Artikelnummer.0").value.toString;

if (A = "F.800.600") this.getField("Artikelbezeichung.0").value = "PM14/18 FFH 420-800/FFB 370-600",this.getField("Montagezeit.0").value=60, this.getField("Einzelpreis.0").value="103,83";

else if (A = "F.800.800") this.getField("Artikelbezeichung.0").value = "PM14/18 FFH 420-800/FFB 600-800",this.getField("Montagezeit.0").value=60, this.getField("Einzelpreis.0").value="116,73";

wenn ich dann in das Feld Artikelnummer.0 F.800.600 eingebe, werden die Felder nicht automatisch ausgefüllt. wo hab ich den Fehler gemacht?

mfg

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Can you share the form?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

157

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

Stringabfrage

New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

Hallo zusammen,
hätte mal eine Frage,

A =this.getField("Artikelnummer.0").value.toString;

if (A = "F.800.600") this.getField("Artikelbezeichung.0").value = "PM14/18 FFH 420-800/FFB 370-600",this.getField("Montagezeit.0").value=60, this.getField("Einzelpreis.0").value="103,83";

else if (A = "F.800.800") this.getField("Artikelbezeichung.0").value = "PM14/18 FFH 420-800/FFB 600-800",this.getField("Montagezeit.0").value=60, this.getField("Einzelpreis.0").value="116,73";

wenn ich dann in das Feld Artikelnummer.0 F.800.600 eingebe, werden die Felder nicht automatisch ausgefüllt. wo hab ich den Fehler gemacht?

mfg

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Can you share the form?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

158

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
Apr 03, 2018 0
Most Valuable Participant ,
Apr 03, 2018

Copy link to clipboard

Copied

The comparison operator of JS is " == ", not " = "...

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...
Apr 03, 2018 0
New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

Danke, aber das funktioniert auch nicht, z.B.: (A=="F.800.600")

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...
Apr 03, 2018 0
Most Valuable Participant ,
Apr 03, 2018

Copy link to clipboard

Copied

Each getField command has to be separate. You can't separate them with a

comma in the same line of code.

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...
Apr 03, 2018 0
Adobe Community Professional ,
Apr 03, 2018

Copy link to clipboard

Copied

You must use following:

if (      ) {

command;

command;

command;

} else if (        ) {

command;

command;

command;

}

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...
Apr 03, 2018 0
New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

Danke ich werde es gleich probieren

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...
Apr 03, 2018 0
New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

Dankeschön hat geholfen, aber jetz bekomme ich die Fehlermeldung:

TypeError: this.getField(...) is null

3:Field:Calculate

habe aber schon

A =this.getField("Artikelnummer.0").value.toString();

und

A =this.getField("Artikelnummer.0").valueAsString;

ausprobiert.

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...
Apr 03, 2018 0
Adobe Community Professional ,
Apr 03, 2018

Copy link to clipboard

Copied

This happens when the field with this name doesn't exist.

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...
Apr 03, 2018 0
New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

But this Field Artikelnummer.0 exist.

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...
Apr 03, 2018 0
Adobe Community Professional ,
Apr 03, 2018

Copy link to clipboard

Copied

What happens when you use "Artikelnummer" ?

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...
Apr 03, 2018 0
New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

Dann kommt im Debugger auch diese Meldung:

TypeError: this.getField(...) is null

3:Field:Calculate

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...
Apr 03, 2018 0
Most Valuable Participant ,
Apr 03, 2018

Copy link to clipboard

Copied

The field name is incorrect, or the field itself is corrupt. Did you add it in Acrobat or in another application (like InDesign)?

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...
Apr 03, 2018 0
Adobe Community Professional ,
Apr 03, 2018

Copy link to clipboard

Copied

Can you share the form?

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...
Apr 03, 2018 0
New Here ,
Apr 03, 2018

Copy link to clipboard

Copied

wie kann ich mein PDF teilen, kann nur Bilder teilen?

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...
Apr 03, 2018 0
Adobe Community Professional ,
Apr 03, 2018

Copy link to clipboard

Copied

Use Tools > Send & Track

and post the link

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...
Apr 03, 2018 0
Most Valuable Participant ,
Apr 03, 2018

Copy link to clipboard

Copied

Or something like Dropbox or Google Drive...

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...
Apr 03, 2018 0
New Here ,
Apr 04, 2018

Copy link to clipboard

Copied

http://www.truna.de/pdf/Schirrmacher Kalkulation.pdf

That's the whole Form.

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...
Apr 04, 2018 0
Most Valuable Participant ,
Apr 04, 2018

Copy link to clipboard

Copied

- Move the code to be a custom validation script, instead of calculation.

- Replace:

this.getField("Artikelnummer.0").value.toString()

With:

event.value

- You have a mistake in the name of the "Artikelbezeichnung.0" field. You're referring it as "Artikelbezeichung.0" in your code (notice the missing "n" in "-nung"). German names are tricky when it comes to field names, nicht wahr? 🙂

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...
Apr 04, 2018 2
New Here ,
Apr 04, 2018

Copy link to clipboard

Copied

Danke schön, sehr geholfen, hast was gut!

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...
Apr 04, 2018 0
Most Valuable Participant ,
Apr 03, 2018

Copy link to clipboard

Copied

This line is also incorrect:

A = this.getField("Artikelnummer.0").value.toString;

toString is a function. To use it you must call it, like this:

this.getField("Artikelnummer.0").value.toString();

Or simply use:

this.getField("Artikelnummer.0").valueAsString;

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...
Apr 03, 2018 0