Thursday, May 2, 2013

Concerto Simple Demonstration Test v4.b

# This is my first attempt to post a example of a test using Concerto 4 beta.


# This is an extremely simple test.  Too simple to be useful to most people yet I believe it is didactically helpful.


The Following is the HTML code for Template 9. It is the form that the user first inputs answers to the three questions.

Template Description/Name: FixedSimpleQuestions

<p>Please Answer:</p>

<!--This displays each question.  The important thing to notice is the name of each text box, txt_1, txt_2, and txt_3-->
<p>1. 1+1=<input name="txt_1" type="text" /></p>

<p>2. 2+2=<input name="txt_2" type="text" /></p>

<p>3. 3+3=<input name="txt_3" type="text" /></p>

<p><input name="done" type="button" value="done" />​</p>


The Following is the HTML code for Template 10. It is the form that the user receives feedback from.

Template Description/Name: FixedSimpleResults

<p>You got questions:</p>

<!-- Notice the values in {{}}.  These are the parameters passed to this template -->

<p>1. {{score1}}</p>

<p>2. {{score2}}</p>

<p>3. {{score3}}</p>


# The Following is the R code that the test actually uses to run.

# We can see how R controls the flow of the user interface.

# Concerto Simple Test 1

# We call template 9, FixedSimpleQuestions, to be shown.  It can either be referenced by the template number of the name of the template.
items = concerto.template.show("FixedSimpleQuestions")

# Check if the items results are correct.  We can see that the responses to the items from the first template are saved within the list object item with the names txt_1, txt_2, and txt_3.
TF1 = items$txt_1==2
TF2 = items$txt_2==4
TF3 = items$txt_3==6

# Show the results to the user by feeding our item values as parameters back into the second template.
concerto.template.show("FixedSimpleResults", params=list(score1=TF1, score2=TF2, score3=TF3))

# I hope this gives you a feel for how easy it is to use Concerto to handle web based inputs.

# A powerful feature of Concerto is that it has functions that and query and modify tables using My SQL.

# More in future posts.

# I used an HTML encoder to translate my html code to post into blogger.

No comments:

Post a Comment