0

I am building a quiz program from the tutorial: http://blogs.technet.com/b/brenclarke/archive/2009/04/14/creating-a-quiz-web-application-using-sharepoint-designer-part-4.aspx

In it, I use a submit button with the code:

<input name="Submit1" type="submit" value="submit" onclick="javascript     {ddwrt:GenFireServerEvent(concat('__commit;__redirect={ShowQuestion.aspx?Title=',$URL1,'&amp;Question=',$NextQNumber,'&amp;Of=',$URL2,'&amp;Session=',$URL3,'}'))}" />

Unfortunately, users are able to click-through and submit to the answers list multiple times for the same question, because there is no limit to the number of clicks/submissions per page. After Googling I saw two main options. One is to put some more code in, as shown in this link: (https://stackoverflow.com/questions/926816/how-to-prevent-multiple-form-submit-from-client-side) while the other is to change the button to a loading button that is dead when pressed the first time. Unfortunately, I am unsure of how to do either for my lines of code. I understand it can be tough to call multiple functions within a single command, so I've been intimidated by that. Please try to recommend a fix for this or more information regarding the solutions given. I unfortunately have no experience coding in javascript before this tutorial.

  • 1
    Have you considered cookies? Though they can be deleted, it's the only client-side tool you can use to prevent multiple submits to the same quiz by the same users. – user2536 Jul 30 '13 at 20:58
  • I have considered cookies, but was discouraged because of (like you mentioned) their ease of deletion. Considering that my users are Microsoft authenticated and I have already set up the ability to pull the unique login name of the user I believed I could moderate their clicking. I was thinking of a script like: onclick add one to a variable if variable <1 submit like normal else terminate button functionality but am unsure of javascript's ability to do that type script. – user2498810 Jul 30 '13 at 21:26
1

u can user jquery to disable the button after its clicked import jquery to your page ... at the end of the page add an eventhandel

$(yourbuttonid).click(function(this){this.disable();}); somthing like that should do it

  • Would this require jquery to be installed on users' computers or could it be included somewhere in my page's script and it call on a server that hosts the jquery language code? – user2498810 Jul 30 '13 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.