English 中文(简体)
隐藏包含只读字段的MS CRM表单中的一个部分
原标题:
  • 时间:2008-12-05 06:30:24
  •  标签:

JavaScript: JavaScript

我有一些代碼,根據 Picklist 的值,可以隱藏 MS CRM 表單中的各個部分。該代碼在 Picklist 的 onChange 事件中執行。它通過引用該部分中的一個字段,然後使用 ParentElement 語法向上導航到 DOM 來隱藏該部分,如下所示:

crmForm.all.fieldName.parentElement.parentElement.parentElement.style.display = none; crmForm.all.fieldName.parentElement.parentElement.parentElement.style.display = 无;

这似乎起作用了,但有一个例外。有一个只读字段引起了问题,我认为这可能是原因。没有错误被抛出。我还尝试了带有2个和4个“.parentElement”块的变化。

我如何隐藏这个部分?

最佳回答

Take a look at the following post. it uses section position instead of parentElement. http://mscrm4ever.blogspot.com/2008/08/show-hide-crm-form-section.html

问题回答

Sorry, buy can you clean up the question? You say it works with 1 exception when the section has a read-only field. Is that the field you are trying to work with in your example? Or can you work with any field in the section, but if there is one read only in the section it fails? What is the exception (doesn t work, javascript error)?

The previous suggestion of hiding by section # will work. Or you could also try using fieldname_c instead of fieldname (and should only need 2 parentElements). _c is the "comment" (label) for the field and should be a bit more consistent.





相关问题
热门标签