Include a content editor web part in the page (newform.aspx/editform.aspx) and use jQuery (or just plain JavaScript) to handle the setting of default values.
Edit: some example code:
In the lists newform.aspx, include a reference to jquery. If you look at the html code, you can see that each input tag gets an id based on the field's GUID, and a title that's set to the fields display name.
now, using jquery we can get at these fields using the jQuery selector like this:
By title:
$("input[title='DISPLAYNAMEOFFIELD']");
by id (if you know the field's internal guid, the dashes will ahve to be replaced by underscores:
// example field id, notice the guid and the underscores in the guid ctl00_m_g_054db6a0_0028_412d_bdc1_f2522ac3922e_ctl00_ctl04_ctl15_ctl00_ctl00_ctl04_ctl00_ctl00_TextField
$("input[id*='GUID']"); //this will get all input elements of which the id contains the specified GUID, i.e. 1 element
We wrap this in the ready() function of jQuery, so all calls will only be made when the document has fully loaded:
$(document).ready(function(){
// enter code here, will be executed immediately after page has been loaded
});
By combining these 2 we could now set your dropdown's onchange event to the following
$(document).ready(function(){
$("input[title='DISPLAYNAMEOFFIELD']").change(function()
{
//do something to other field here
});
});
我的同事写了一篇文章解释我们试图做到这一点的方法,这些方法对我们来说并不奏效 - 可能会有所帮助。 http://blog.pentalogic.net/2011/08/how-not-to-develop-a-sharepointtoday-calculated-column/ – Ryan 2012-02-14 13:37:02
是的,我已经看到了这个网页在我的搜索后解决方案。我怀疑除了购买他提供的插件外,没有别的解决方案。特别是对于一个看起来很小的问题。 – Jake 2012-02-14 23:17:03
那么我会等着你告诉我他是怎么错的,特别是对于那么微小的事情;)一个想法 - 为什么不编辑你的q并告诉我们你想要达到的目标,而不是你想要做什么 - 我想我可以猜测但不确定 - 那么可能会有一种替代方法来处理这个问题。 – Ryan 2012-02-15 08:37:45