尝试使用存储在自定义按钮中的 JavaScript 隐藏该字段。在按钮的 On-Click JavaScript 中,您可以包含将在页面加载时由隐藏电子邮件字段的 jQuery 运行的代码。然后,您也可以隐藏实际按钮。非常黑客的方法,但它应该工作。
这里有一些代码可以放入 On-Click JavaScript 按钮(根据Daniel Llewellyn 的博客文章 和mgsmith 的 force2b 博客文章修改)。希望这能让你快速入门。我没有包含有关如何隐藏电子邮件字段的任何代码,但您说您已经通过 Visualforce 页面尝试过,所以我想我会把这部分留给您。干杯!
var interval;
//The main function that does all the work
function appendScript() {
// Include core jQuery library by injecting it into the DOM
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js';
head.appendChild(script);
// It takes a second to load, so put in a delay
// (we don't want to try and reference the script
// before it is actually loaded, so we store the interval
// in a global variable, and set up an interval.
// this interval dealio. This will keep running
// until jQuery has been found to be loaded and then
//clears the interval so it doesn't keep running.
interval=self.setInterval(function(){
//Check to see if jQuery has loaded
if(jQuery) {
//if jQuery has loaded, clear the interval
window.clearInterval(interval);
// Hide the Email field
// Hide the custom button
var btnName = 'buttonName';
try{
var buttons = parent.document.getElementsByName(btnName);
for (var i=0; i < buttons.length; i++) {
buttons[i].className="btnDisabled ";
buttons[i].disabled=true;
buttons[i].type='hidden';
}
} catch(e) {
// var ee = e.message || 0; alert('Error: \n\n'+e+'\n'+ee);
}
}
}, 300);
}
appendScript();