1

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?

1 Answer 1

0

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)

3
  • 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, 2011 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, 2012 at 16:08
  • @Kris There are a couple different ways which I've documented here: sputility.codeplex.com/…
    – Kit Menke
    Nov 28, 2012 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.