문제

I would like to use standard SharePoint form for list (NewForm.aspx), but want to auto submit it after specified time - 60 minutes to list. All fields will be optional. This will be used for quiz for users.

Is there a way how to simply insert a piece of script into NewForm.aspx source to do this? Or with use of customized form instead?

도움이 되었습니까?

해결책

I'm not sure why you would want to do this but... you could probably accomplish this with a little JavaScript on the page.

My JavaScript library of choice is Prototype.js so you can find the OK buttons with a selector like:

input[id$="diidIOSaveItem"]

Then, it is just a matter of "clicking" them after an hour (60 minutes * 60 seconds * 1000 = 3,600,000 ms):

function SubmitFormAfterAnHour() {
    $$('input[id$="diidIOSaveItem"]').each(function(elem){
        elem.onclick();
    });
}
setTimeout("SubmitFormAfterAnHour()", 3600000);

(I am typing this in Notepad so please test)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top