简体   繁体   English

用于简单显示隐藏的Adobe Livecycle Javascript总体逻辑

[英]Adobe Livecycle Javascript Overall Logic for Simple Show Hides

I'm attempting to use a large amount of simple show/hide scripts in Adobe Live Cycle to combine a few forms into one. 我试图在Adobe Live Cycle中使用大量简单的显示/隐藏脚本,以将几种形式组合为一种。 I'll be layering text entry fields on top of each other and have them all start as invisible (using Live Cycle's invisible settings). 我将文本输入字段彼此叠加,使它们都以不可见的方式开始(使用Live Cycle的不可见设置)。 The showing/hiding of these objects will be controlled through use of a drop down list. 这些对象的显示/隐藏将通过使用下拉列表进行控制。

The basic task would be: 基本任务是:

-Click an item from  a dropdown list.
-Initiate a show of relative invisible elements on the page based on the 
 raw value of the item selected.
-If user changes dropdown value, hide previously displayed data and show new
 corresponding data.

Can this all be accomplished from inside the dropdown list itself? 是否可以从下拉列表本身内部完成所有操作? I've inherited this project from a previous developer, so I'm cobbling together some of his code and attempting to get a grip on what actually needs to be done so that I can accomplish the task. 我已经从以前的开发人员那里继承了这个项目,所以我将他的一些代码整理在一起,并试图掌握实际需要完成的工作,以便我可以完成任务。 Here is an example of what the show hide structure looks like: 以下是显示隐藏结构的示例:

xfa.resolveNode("form1.#subform.indPaymentOptions").selectedIndex = 0;
xfa.resolveNode("form1.#subform.VendPaymentOptions").selectedIndex = 0;
xfa.resolveNode("form1.#subform.Display_Field_Pay_Types").rawValue = 
    "Please select an option from the 'Select type' drop-down menu above.";
taxReportable.rawValue = "";
AccountCodesDynamic.rawValue = "";

if (xfa.resolveNode("form1.#subform.payeeType").rawValue == 2) {
    xfa.resolveNode("form1.#subform.indPaymentOptions").presence = "visible";
    xfa.resolveNode("form1.#subform.VendPaymentOptions").presence = "hidden";
}

else if (xfa.resolveNode("form1.#subform.payeeType").rawValue == 3) {
    xfa.resolveNode("form1.#subform.indPaymentOptions").presence = "hidden";
    xfa.resolveNode("form1.#subform.VendPaymentOptions").presence = "visible";
}
else if (xfa.resolveNode("form1.#subform.payeeType").rawValue == 1) {
    xfa.resolveNode("form1.#subform.indPaymentOptions").presence = "hidden";
    xfa.resolveNode("form1.#subform.VendPaymentOptions").presence = "hidden";

}

All the code above seems pretty straightforward, but there is also some code in the initialize section of the document: 上面的所有代码看起来非常简单,但是文档的initialize部分中还包含一些代码:

    if (xfa.resolveNode("#subform.RadioButtonList[2].ind").rawValue == 1)
    indPaymentOptions.presence = "visible";

else if (xfa.resolveNode("#subform.RadioButtonList[2].vend").rawValue == 2)
    vendPaymentOptions.presence = "visible";

I'm curious to know if this sort of thing is necessary. 我很好奇是否需要这种事情。 If it is, could someone please explain to what extent such code is needed in the initialize section of the document? 如果是这样,有人可以在文档的初始化部分中说明在何种程度上需要这种代码吗?

If it isn't necessary, is the show/hide coding that I pasted at the top of this post sufficient for what I'm trying to accomplish? 如果没有必要,那么我粘贴在这篇文章顶部的show / hide编码是否足以满足我想要完成的任务?

I've tried slogging through Adobe's livecycle documentation, but it is difficult to find a broad overview of what is necessary, so I'm having difficulty making use of it. 我已经尝试过遍历Adobe的livecycle文档,但是很难找到所需内容的广泛概述,因此我很难利用它。 Any help is greatly appreciated. 任何帮助是极大的赞赏。 If there is a resource I'm missing I would love to teach myself how to do this. 如果我缺少资源,我很想教自己如何做。 Also, this is my first post here. 另外,这是我在这里的第一篇文章。 I did my best to follow the submission guidelines in the FAQ, but apologies in advance if I violated any submission guidelines. 我尽力遵循FAQ中的提交准则,但是如果我违反了任何提交准则,请提前道歉。 Thanks. 谢谢。

The code for the drop-down looks pretty straight forward and should be fine (although you will probably find after using LiveCyle for a while, even some of the simpler tasks with logical code don't work). 下拉菜单的代码看起来很简单,应该很好(尽管使用LiveCyle一段时间后您可能会发现,即使是一些带有逻辑代码的简单任务也无法使用)。

The code in the initialize event is actually for a radiobutton group rather than the drop-down so it's possible that the functionality of the visible forms is actually driven by more than just the drop-down. Initialize事件中的代码实际上是用于单选按钮组的,而不是下拉菜单的,因此可见表单的功能实际上可能不仅仅是下拉菜单驱动的。

What you tend to end up with in LC is the code for a change or validate event being repeated in the initialize event so that when the form opens it displays/processes correctly. 在LC中,最终的结果是更改或验证事件的代码在Initialize事件中重复出现,以便在窗体打开时正确显示/处理。 This can of course be worked around by invoking an event with the code from the object's other eventsevent. 当然,这可以通过使用对象的其他事件中的代码调用事件来解决。 eg. 例如。 in the Drop-down initialize event you would hold the dropdown code and in the change event of the dropdown you would use this.execEvent("initialize") which would call the code when the change event is triggered. 在下拉初始化事件中,您将保存下拉代码;在下拉事件的change事件中,您将使用this.execEvent(“ initialize”)在触发更改事件时调用代码。

It's a little difficult to get a view of what's happening in your particular case without seeing the form but let me know if anything isn't clear or I can help with anything else. 不查看表格就很难了解特定情况下的情况,但是如果有任何不清楚的地方或需要其他任何帮助的话,请告诉我。

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

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