Skip to content

Commit

Permalink
NEW: New question attribute for Short Text and Numerical "text_input_…
Browse files Browse the repository at this point in the history
…width" - sets "size" of the text box used.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1190 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Sep 16, 2004
1 parent 08263ff commit 6997041
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions qanda.php
Expand Up @@ -1142,8 +1142,27 @@ function do_multipleshorttext($ia)

function do_numerical($ia)
{
$qidattributes=getQuestionAttributes($ia[0]);
if ($maxchars=arraySearchByKey("maximum_chars", $qidattributes, "attribute", 1))
{
$maxsize=$maxchars['value'];
}
else
{
$maxsize=255;
}
if ($maxchars=arraySearchByKey("text_input_width", $qidattributes, "attribute", 1))
{
$tiwidth=$maxchars['value'];
}
else
{
$tiwidth=10;
}
$answer = keycontroljs()
. "\t\t\t<input class='text' type='text' size='10' name='$ia[1]' id='{$ia[1]}' value=\"{$_SESSION[$ia[1]]}\" onKeyPress=\"return goodchars(event,'0123456789.')\"/><br />\n"
. "\t\t\t<input class='text' type='text' size='$tiwidth' name='$ia[1]' "
. "id='{$ia[1]}' value=\"{$_SESSION[$ia[1]]}\" onKeyPress=\"return goodchars(event,'0123456789.')\" "
. "maxlength='$maxsize' /><br />\n"
. "\t\t\t<font size='1'><i>"._NUMERICAL_PS."</i></font>\n";
$inputnames[]=$ia[1];
$mandatory=null;
Expand All @@ -1161,7 +1180,15 @@ function do_shortfreetext($ia)
{
$maxsize=255;
}
$answer = "\t\t\t<input class='text' type='text' size='50' name='$ia[1]' id='$ia[1]' value=\""
if ($maxchars=arraySearchByKey("text_input_width", $qidattributes, "attribute", 1))
{
$tiwidth=$maxchars['value'];
}
else
{
$tiwidth=50;
}
$answer = "\t\t\t<input class='text' type='text' size='$tiwidth' name='$ia[1]' id='$ia[1]' value=\""
.str_replace ("\"", "'", str_replace("\\", "", $_SESSION[$ia[1]]))
."\" maxlength='$maxsize' />\n";
$inputnames[]=$ia[1];
Expand Down

0 comments on commit 6997041

Please sign in to comment.