Copy link to clipboard
Copied
Greetings,
I am creating a PDF but having some techincal issues.
Here is an image for reference.
There is a dropdown list named Materials. I would like the Material Price and the Line Total to be set to $58.00 when you've picked INCOMING MINIMUM LOAD 500.
So far i've tried this script to no avail,
var f = this.getfield("Material");
switch(event.value){
case "INCOMING MINIMUM LOAD 500 ":
f.setMaterialPrice(58);
Any help would be greatly appreciated!
Copy link to clipboard
Copied
To be more succinct, I was trying to change a field based on a combo list choice. Upon some research i've found the solution on this page. Changing another field with combo box (drop down) selection. Thanks.
Copy link to clipboard
Copied
Check the Javascript console for errors.
Copy link to clipboard
Copied
It says Syntax error 7: At line 9 when i attempt to insert the code.
Copy link to clipboard
Copied
The end of the switch is missing.
Copy link to clipboard
Copied
You can't just invent stuff and expect it to work.
setMaterialPrice is not the name of a Field object's method.
To set a field's value you must use the value property, like this:
f.value = 58;
Also, JS is case-sensitive, so "getfield" will not work. It's "getField".
And using a switch for a single comparison doesn't make sense, either. Use an if command.
Copy link to clipboard
Copied
Thanks for the input. I've never scripted in JavaScript or any language for that matter. I guess it's time to learn! Trying f.value right now.
Copy link to clipboard
Copied
To be more succinct, I was trying to change a field based on a combo list choice. Upon some research i've found the solution on this page. Changing another field with combo box (drop down) selection. Thanks.

