【发布时间】:2014-12-26 17:31:20
【问题描述】:
我正在尝试将 Sales Stage 字段标签更改为超链接以弹出新的浏览器窗口。
目前我有一个带有下拉列表的销售阶段字段的表单::
底层 HTML:
<td title="Select the sales process stage for the opportunity to indicate the probability of closing the opportunity." class="ms-crm-ReadField-Normal ms-crm-FieldLabel-LeftAlign" id="salesstagecode_c"><span class="ms-crm-InlineEditLabel"><span class="ms-crm-InlineEditLabelText" style="text-align: left; max-width: 115px;">Sales Stage</span><div class="ms-crm-Inline-GradientMask" style="display: none;">
</div></span></td>
或者更好的格式:
我之前在旧版表单上使用的函数:
function csjs_AddHyperlinkToLabel(sFieldId, sURL, sWindowOptions) {
var sCurrentLabel = $("label[for='" + sFieldId + "']").html();
$("label[for='" + sFieldId + "']").html("<a href=\"#\" onclick=\"window.open('" + sURL + "', null, '" + sWindowOptions + "'); return false;\" style=\"cursor:hand; color:blue; text-decoration:underline;\">" + sCurrentLabel + "</a>");
}
上面的函数作用于具有以下 html:: 的表单
需要对 javascript 进行哪些更改才能将 Sales Stage 字段标签更改为超链接以弹出新的浏览器窗口?
虽然我非常感谢您提供解决方案,但我正在寻找有关如何完成此任务的指导。感谢您的关注和时间。
很遗憾,以下解决方案不起作用。我通过调试器运行了它,这就是我得到的http://screencast.com/t/fT6tHvXZzvc
这里的问题是我们将“salesstagecode”传递给这个函数:
csjs_AddHyperlinkToLabel("salesstagecode", sPageURL, sWindowFeatures);
结果是NULL:
var sCurrentLabel = $("label[for='" + sFieldId + "']").html();
*
问题是微软改变了表单的呈现方式,并且 呈现页面的 HTML 将不再以 函数写好了。标签现在位于跨度标签中,而不是 标签标签。我不知道是否有办法识别跨度和 更改内容以使用新的 HTML 来制作文本链接。
*
如何更新 span 标签?
【问题讨论】:
标签: javascript jquery ajax dom dynamics-crm