Hello,
I think I have a quite easy question but i don't know how I can implement this simple example in silverstripe.
This is the HTML code:
What is the question?
<form name="Question1">
<input name="rbQuestion1" type="radio">A) possible answer 1
<input name="rbQuestion1" type="radio">B) possible answer 2
<input name="rbQuestion1" type="radio">C) possible answer 3
<input value="answer" onclick="checkQuestion" type="submit">
</form>
And I want to check in the function "checkQuestion" if the choosed answer is the right answer.
function checkQuestion()
{
var QuestionChecked = false;
for (var i=0; i<window.document.Question1.length; i++)
{
if (window.document.Question1.checked)
{
QuestionChecked = true;
}
}
if (QuestionChecked )
{
if(window.document.Question1.elements[1].checked==true)
{
alert("right!");
}
else
{
alert("wrong!");
}
}
else
{
alert("Please choose an existing answer!");
}
}
How I can realize this in silverstripe?
Regards Beppo