Mutley
08-14-2008, 12:03 PM
Sometime ago I started working on creating an online survey.
I ended up ditching Flex as it was disrupting development on the actual survey mechanics so returned to Javascript, storing the code in a file which is called from within the html section of a php file which contains the sql connectivity code, etc. This works really well but doesn't look very good.
I want to return to Flex using its radiobutton, checkbox, etc components so that it looks nicer taking advantage of the advanced formatting in Flex.
Currently the formatting for the survey where questions are displayed is done in javascript, for example to add answer to a survey question which is dynamically called from an SQL database:
function addAnswerLine() {
var el = document.getElementById('answerlines');
var numchoice = document.getElementById('num_choices').value;
numchoice++;
var tablerow = el.insertRow(numchoice+1);
var tablecell = tablerow.insertCell(-1);
tablecell.innerHTML = numchoice+".";
tablecell.className = "numbered";
tablecell = tablerow.insertCell(-1);
var text = "<input type=\"hidden\" name=\"choice_id_"+numchoice+"\" value=\"\" />\n";
text = text+"<input type=\"text\" size=\"60\" name=\"choice_content_"+numchoice+"\" value=\"\" />\n";
tablecell.innerHTML = text;
tablecell.className = "left";
document.getElementById('num_choices').value = numchoice;
}
The type of menu required - check box or radio button - each type given a particular ID - is stored in a table in the database and the respective type needed is called as part of an sql query. This then ultimately governs what type of menu is presented to the user.
However I know this won't work in Flex as it is!
Also the Javascript files contain functions which display only one question and the respective answers as shown above per page.
I am assuming a lot of the php can remain the same as the HTML section which calls this javascript is quite simple.
Where do I start!?!
I hope this won't require a complete re-write!
I ended up ditching Flex as it was disrupting development on the actual survey mechanics so returned to Javascript, storing the code in a file which is called from within the html section of a php file which contains the sql connectivity code, etc. This works really well but doesn't look very good.
I want to return to Flex using its radiobutton, checkbox, etc components so that it looks nicer taking advantage of the advanced formatting in Flex.
Currently the formatting for the survey where questions are displayed is done in javascript, for example to add answer to a survey question which is dynamically called from an SQL database:
function addAnswerLine() {
var el = document.getElementById('answerlines');
var numchoice = document.getElementById('num_choices').value;
numchoice++;
var tablerow = el.insertRow(numchoice+1);
var tablecell = tablerow.insertCell(-1);
tablecell.innerHTML = numchoice+".";
tablecell.className = "numbered";
tablecell = tablerow.insertCell(-1);
var text = "<input type=\"hidden\" name=\"choice_id_"+numchoice+"\" value=\"\" />\n";
text = text+"<input type=\"text\" size=\"60\" name=\"choice_content_"+numchoice+"\" value=\"\" />\n";
tablecell.innerHTML = text;
tablecell.className = "left";
document.getElementById('num_choices').value = numchoice;
}
The type of menu required - check box or radio button - each type given a particular ID - is stored in a table in the database and the respective type needed is called as part of an sql query. This then ultimately governs what type of menu is presented to the user.
However I know this won't work in Flex as it is!
Also the Javascript files contain functions which display only one question and the respective answers as shown above per page.
I am assuming a lot of the php can remain the same as the HTML section which calls this javascript is quite simple.
Where do I start!?!
I hope this won't require a complete re-write!