Skip to content

Instantly share code, notes, and snippets.

@afzafri
Last active December 25, 2017 14:54
Show Gist options
  • Save afzafri/8019028ae47a9e5eb6234d79f4709cf5 to your computer and use it in GitHub Desktop.
Save afzafri/8019028ae47a9e5eb6234d79f4709cf5 to your computer and use it in GitHub Desktop.
Latest i-learn v3.0 UiTM SuFO autofill form
// SuFO autofill form script
// Usage: copy the scripts, go to the SuFO page, press F12 (open console), paste the code and enter
console.log("SuFO autofill form script - Afif Zafri");
// loop all 24 questions
for(y=0; y<24; y++)
{
// get all radios
var questionNo = document.getElementsByName('data[AnalyticSufo][answer'+y+']');
// generate random number,
// then check if the number is odd or even for random check the input
var randnum = Math.floor(Math.random() * (51 - 1 + 1)) + 1;
if(randnum % 2 == 0)
questionNo[3].checked=true
else
questionNo[2].checked=true
}
// submit form
surveyForm.submit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment