I created an EPUB through Adobe InDesign CC. After exporting the project to EPUB i extracted the file so that I can insert a (html, javascript) page for the exercises. Could somebody please help how can I manage to throw a value from the epub (probably the score) to a website if online and store the value(score) inside the epub when offline.
<form action="#" method="post">
<section id="1" epub:type="item">
<p>1. smile - smiled <label id="checker" style="color:red"></label></p>
<input type="radio" id="myRadio" name="c1" value="1" />
<label>YES</label>
<input type="radio" id="myRadio" name="c1" value="0" />
<label>NO</label><br/>
</section>
<section id="2" epub:type="item">
<p>2. dance - danced <label id="checker2" style="color:red"></label></p>
<input type="radio" id="myRadio2" name="c2" value="1" />
<label>YES</label>
<input type="radio" id="myRadio2" name="c2" value="0" />
<label>NO</label><br/>
</section>
<section id="3" epub:type="item">
<p>3. rise - rised <label id="checker3" style="color:red"></label></p>
<input type="radio" id="myRadio3" name="c3" value="1" />
<label>YES</label>
<input type="radio" id="myRadio3" name="c3" value="0" />
<label>NO</label><br/>
</section>
</div>
</form>
Heres the javascript:
temp = 0;
if (getRadioVal( document.getElementById('demoForm'), 'c1' ) === "1") {
temp = temp + 1;
} else{
document.getElementById('checker').innerHTML = "| wrong";
}
if (getRadioVal( document.getElementById('demoForm'), 'c2' ) === "1") {
temp = temp + 1;
} else{
document.getElementById('checker2').innerHTML = "| wrong";
}
if (getRadioVal( document.getElementById('demoForm'), 'c3' ) === "0") {
temp = temp + 1;
} else{
document.getElementById('checker3').innerHTML = "| wrong";
}
document.getElementById("score").innerHTML = temp;
This question has been discussed in some Adobe Forum and the answer seems like you can't: https://forums.adobe.com/thread/1939249