Javascript HTML5

May 24, 2016

Hi everyone, 

I created a various object for a web platform with access from PC, tablet and smartphone (iOS and Android), without the articulate player and without an LMS platform (client requeriment).

So, for tracking the activities of students I created a javascript code like this:

var p = GetPlayer();

var varPregunta1 = p.GetVar("pregunta1");
var varPregunta2 = p.GetVar("pregunta2");
var varPregunta3 = p.GetVar("pregunta3");
var varPregunta4 = p.GetVar("pregunta4");
var varPregunta5 = p.GetVar("pregunta5");
var varPregunta6 = p.GetVar("pregunta6");

var sHTML = "";

sHTML += "<form id='formScore' method='post' action='http://127.0.0.1/AE/request17.php'>";

sHTML += "<input type='hidden' name='Pregunta1' value='U,TDI,PrecioPropuestaValor,Pregunta1," + varPregunta1 + "'>";

sHTML += "<input type='hidden' name='Pregunta2' value='U,TDI,PrecioPropuestaValor,Pregunta2," + varPregunta2 + "'>";

sHTML += "<input type='hidden' name='Pregunta3' value='U,TDI,PrecioPropuestaValor,Pregunta3," + varPregunta3 + "'>";

sHTML += "<input type='hidden' name='Pregunta4' value='U,TDI,PrecioPropuestaValor,Pregunta4," + varPregunta4 + "'>";

sHTML += "<input type='hidden' name='Pregunta5' value='U,TDI,PrecioPropuestaValor,Pregunta5," + varPregunta5 + "'>";

sHTML += "<input type='hidden' name='Pregunta6' value='U,TDI,PrecioPropuestaValor,Pregunta6," + varPregunta6 + "'>";

sHTML += "<br><input type='submit'><br>";

sHTML += "<form>";

document.getElementById("divEmail").innerHTML = sHTML;

document.getElementById("formScore").submit();

-----

In request17.php I have the intelligence to store data into a database. 

It works perfect in story.html but in story_html5.html dont work. Any ideas?

Thanks!!

7 Replies
Marc Lee

Hi, Mauricio,

Very cool system, from what you've posted. I don't have a simple answer for the difference between Flash and HTML5 output.  Couple thoughts for further investigation:

-1-Does everything work normally in the HTML5 case other than the write to PHP? (did you try different browsers??).

-2-Did you open the developer's tools window to console to see if there's an error message on the submit command??

-3-Are you working locally?  You might want to upload everything to a remote web server and run.

Let me know if I can help with your tests.

marc@mlmultimedia.com

Christie Pollick

Hi, Maruicio -- Thanks for reaching out! While we are not able to provide support for JavaScript, there are lot of members here in the community who are very knowledgable in that arena and are usually more that willing to stop in with suggestions to assist. I did want to pass along this JavaScript Best Practices sheet in case you'd like to give it a look. :)

Mauricio Saenz

Hi Marc, 

Thanks for your answer. 

1. Work normally in flash but not in HTML5. All of this is in different browsers (Chrome, Firefox, Opera, IE)

2. Yes, I have an error  (innerHTML) but only when work with HTML5. Maybe the solution is working with Ajax, but I don't have any solution yet. 

3. I working into the server ;)

Thanks for your answer!!

Steve Flowers

Hey, Mauricio - 

AJAX would definitely fix this issue. The Div you're attempting to load the form into does not exist in story_html5.html. If you'd like to avoid using AJAX, programmatically create your own DIV and style it to be hidden. Then target the load of the form into the DIV you created.

var hiddenDiv = document.createElement('div');
hiddenDiv.style.visibility="hidden";
hiddenDiv.innerHTML = sHTML;

This discussion is closed. You can start a new discussion or contact Articulate Support.