Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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)

share|improve this answer
    
Thank you Kit, this works for me. Reason why is, that my team wants to provide any quiz attendees only specific timeframe for quiz. Thanks again, m. –  user483 Feb 23 '11 at 17:06
    
this would be ideal for a quiz I have as well, can you tell me where I would put the script? Kris –  Kris Nov 28 '12 at 16:08
    
@Kris There are a couple different ways which I've documented here: sputility.codeplex.com/… –  Kit Menke Nov 28 '12 at 19:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.