Units in Grids

Use of style, HTML, CSS and JavaScript for survey presentation.

Units in Grids

Postby christof » Mon Feb 01, 2010 4:30 am

Hello dear colleagues,

I have a problem displaying units after a numeric question input filed in grids. I wrote a question template which works fine with single questions and loops displayed as a serie of single question (f2[..].ask() ) but not when displayed as a grid (f2.Ask() )

The template looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mrSubTemplate>
<p><mrData QuestionElement="Label" /></p>
<p><mrData QuestionElement="Error" /></p>
<table>
<tr>
<td>
<mrData QuestionElement="Controls" />
</td>
<td style="margin-left: 0.3em; font-weight: bold;" valign="top">
%
</td>
</tr>
</table>
</mrSubTemplate>


and I apply the template usig this statement:

Code: Select all
f2[..].f2b.QuestionTemplate = "subtemplates/st_prozent.xml"


Can someone help me with displaying units in grids?

Thank you, Christof
christof
 
Posts: 6
Joined: Fri Jan 15, 2010 5:57 am
Location: Vienna

Re: Units in Grids

Postby James Corriveau » Mon Feb 01, 2010 6:49 am

Hi,

I use the following code to display a % sign. You do NOT need a special template for this. I've not tried it in a grid, but I think it'll probably work.

Code: Select all
    Q16 "How many..."
    long [0 .. 100]
    codes(
    {
        T1 "%"
            style(
                Hidden = true,
                ElementAlign = "Right",
                Width = "0cm"
            )
    } );


Best,
Jamey
James Corriveau
 
Posts: 108
Joined: Tue Sep 05, 2006 12:07 pm
Location: Cincinnati, OH

Re: Units in Grids

Postby christof » Mon Feb 01, 2010 8:42 am

Hi Jamey,

Nice little trick and it works with grids too! Thanks a lot!

greetings christof
christof
 
Posts: 6
Joined: Fri Jan 15, 2010 5:57 am
Location: Vienna

Re: Units in Grids

Postby Tabann » Mon Feb 08, 2010 3:39 pm

Hi all,

Is anything possible to show the units before the text box...for example for $...i could not find anything like ElementAlign = "Left",

Please suggest.

Thanks
Tabann
Tabann
 
Posts: 33
Joined: Thu Mar 12, 2009 4:24 pm

Re: Units in Grids

Postby James Corriveau » Mon Feb 08, 2010 4:16 pm

No, I don't believe you can do that in the metadata/routing. At least I haven't figured out a way. I do it in a custom template.

You can see an example in our free question template library. Look at the "currency" example.
http://www.vergeconsulting.com/Files/VergeTemplates_v1_0.zip
James Corriveau
 
Posts: 108
Joined: Tue Sep 05, 2006 12:07 pm
Location: Cincinnati, OH

Re: Units in Grids

Postby Tabann » Wed Feb 10, 2010 3:36 pm

Thanks James,

For some reasons i cannot view the link.

For simple text questions i can embed the units before the box but for grid questions i am finding it a little difficult. i have an external template for the same but somehow it fails to work in firefox.

It would be great if you post the template if you have so.

Thanking you in anticipation
Tabann
Tabann
 
Posts: 33
Joined: Thu Mar 12, 2009 4:24 pm

Re: Units in Grids

Postby christof » Fri Feb 12, 2010 3:47 am

Hello Tabann,

Maybe you can post your template so we can have a look at it and look for the problem?

christof
christof
 
Posts: 6
Joined: Fri Jan 15, 2010 5:57 am
Location: Vienna

Re: Units in Grids

Postby Tabann » Thu Feb 25, 2010 5:03 pm

Hi! Sorry for teh late reply but was out for a while. Below us what i did but it fails in firefox (mac safari)

below is the matadata:-
C4 "How many of each type of computer do you have in your household? Please include only computers in working condition." loop
{
R1 "Laptop<div id = ""H1"" style = ""visibility:hidden""><font size='2'>#</font></div>",
R2 "Desktop<div id = ""H1"" style = ""visibility:hidden""><font size='2'>#</font></div>"
} fields -
(
IQ ""
long [0 .. 10];

) expand;

and below is the template:

<html>
<head>
<title><mrPageTitle/></title>


<mrRef RefType="link" rel="stylesheet" type="text/css" title="Style" href="aol2.css" />

<style type="text/css">
<!-- hr { color: #003366; background-color: #003366; height: 1px; } -->
<!-- .mrEdit {text-Align: Right; color:#000000; width:33px}-->
<!-- .mrDisplayText {font-weight:normal;font-size:10pt;color:#000000;} -->
<!-- .mrQuestionText {font-weight:normal;font-size:10pt;color:#000000;} -->
<!-- .mrProgressText{font-family:Verdana,Arial;font-size:7pt;color:#000000} -->
<!-- .highlight{font-weight:bold;font-size:10pt;color:#3C3CFF;} -->
<!-- table.mrQuestionTable{width: 710px;border-collapse: collapse; padding: 0px} -->
</style>

<script language="Javascript">
<!--

function addcurrency()
{

for(i=0;i<document.mrForm.length;i++)
{
if (document.mrForm.elements[i].type == 'text')
{

document.mrForm.elements[i].outerHTML = document.mrForm.elements[i].outerHTML+document.getElementById("H1").innerHTML
}
}
};
-->
</script>
</head>
<body onload="addcurrency()">
<!-- <mrRef RefType="script" src="image.js" type="text/javascript">JavaScript</mrRef>--> <mrPage IncludeElementIDs="true"/><blockquote>
<hr />
<table width="100%" cellspacing="0" cellpadding="0" align="right">
<tr>
<td width="40%" align="left">&#160;</td>
<td width="10%" align="left">&#160;</td>
<td width="60%" align="right">
<table width="110" border="1" bordercolor="white">

</table>
</td>
</tr>
</table>

<table border='0' width="98%">
<tr>
<td width="90%"><DIV NAME="testclicker" ID="testclicker" ONKEYUP="loader()" ONCLICK="loader()">
<mrData Index="1" QuestionElement="Errors" />
<mrData Index="1" QuestionElement="Banner" />
<mrData Index="1" QuestionElement="Label" />
<br/>
<br/>
<mrData Index="1" QuestionElement="Controls" /></DIV>
</td>
</tr>
<tr>
<td Align="left">
<mrData Index="2" QuestionElement="Errors" />
<mrData Index="2" QuestionElement="Banner" />
<mrData Index="2" QuestionElement="Label" />
<mrData Index="2" QuestionElement="Controls" />
</td></tr>
<br />
<br />
<tr>
<tr></tr><tr></tr><tr></tr><tr></tr>
<td align="left" width="90%">
<mrNavButton Width = "60px" Name="Prev" Text="&lt;&lt; Previous Screen" />
<mrNavButton Width = "60px" Name="Next" Text="Next Screen &gt;&gt;" />
</td>
</tr>
</table>
<hr />
</blockquote>
</body>
</html>
Tabann
 
Posts: 33
Joined: Thu Mar 12, 2009 4:24 pm

Re: Units in Grids

Postby Tabann » Tue Apr 27, 2010 1:43 pm

Hi Jamey,

I tried the example that you sent. but i ran into a serious problem. I don't know how but respondent sam that codes as a punchable option and have selected that; so i get a response T1 instead of numeric response.

I also run the link and although i didn't saw the punch in codes. but i could proceed without enetring any numeric response.

I just put the cursor on the numeric box then i hit the tab button and then the space bar and it let me proceed. so i actually entered T1 and not a numeric response which must be teh case.

i manually validated it by showing respondent an error message if T1 got selected. But i strongly believe that if some punch is hidden it shown not allow to be punched.

Have you ever ran into such a situation? Am i going wrong anywhere?

Thanks
Tabann
Tabann
 
Posts: 33
Joined: Thu Mar 12, 2009 4:24 pm


Return to Survey Presentation

Who is online

Users browsing this forum: No registered users and 1 guest

cron