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