简体   繁体   English

Adobe Acrobat JavaScript

[英]Adobe Acrobat JavaScript

I'm a graphic designer working on an order confirmation form with Adobe Acrobat.我是一名平面设计师,正在使用 Adobe Acrobat 制作订单确认表。 I know nothing of Javascript but I managed to write a formula to calculate the price of items on the pdf.我对 Javascript 一无所知,但我设法编写了一个公式来计算 pdf 上的物品价格。

Now I'd like to fix one last thing, if I don't want the number to show up when it is less than 0 what should I do?现在我想解决最后一件事,如果我不希望数字小于 0 时出现,我该怎么办?

the script right now is pretty simple: event.value = ( this.getField("fill_1").value * this.getField("Prezzo € x kg Prezzo € x foglioRow1").value )现在的脚本非常简单: event.value = ( this.getField("fill_1").value * this.getField("Prezzo € x kg Prezzo € x foglioRow1").value )

Fill_1 and Prezzo € x kg Prezzo € x foglioRow1 are the names of the cells. Fill_1 和 Prezzo € x kg Prezzo € x foglioRow1 是单元格的名称。

Is there any online tool to help me figure this out?有什么在线工具可以帮助我解决这个问题吗? do you have any advice?你有什么建议吗?

enter image description here在此处输入图像描述

It's a matter of a simple condition.这是一个简单条件的问题。 Does this work?这行得通吗?

var x = ( this.getField("fill_1").value * this.getField("Prezzo € x kg Prezzo € x foglioRow1").value );
event.value = x < 0 ? "" : x;

If the line above didn't work then I'm stumped.如果上面的行不起作用,那么我很难过。 I would the followings:我会做以下事情:

  • what event is that?那是什么活动?
  • does it have more relevant code?它有更多相关的代码吗?
  • did you mean x <= 0 ?你的意思是x <= 0吗?
  • what happens if event.value = 12 ?如果event.value = 12会发生什么?
  • what happens if event.value = 'hello' ?如果event.value = 'hello'会发生什么?
  • what happens if event.value = this.getField("Prezzo € x kg Prezzo € x foglioRow1").value ?如果event.value = this.getField("Prezzo € x kg Prezzo € x foglioRow1").value会发生什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM