Skip to content

Commit

Permalink
Fixed support for prefilling using questioncodes.
Browse files Browse the repository at this point in the history
Dev In case of duplicate question codes (which should not be used anyway),
the prefilling will fill each question.
  • Loading branch information
SamMousa committed Aug 12, 2013
1 parent deb3570 commit 117023d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions application/helpers/frontend_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1538,12 +1538,22 @@ function buildsurveysession($surveyid,$preview=false)
$startingValues=array();
if (isset($_GET))
{
foreach ($_GET as $k=>$v)
foreach ($_GET as $k=>$v)
{
if (!in_array($k,$reservedGetValues) && isset($_SESSION['survey_'.$surveyid]['fieldmap'][$k]))
if (!in_array($k,$reservedGetValues) && isset($_SESSION['survey_'.$surveyid]['fieldmap'][$k]))
{
$startingValues[$k] = $v;
}
else
{ // Search question codes to use those for prefilling.
foreach($_SESSION['survey_'.$surveyid]['fieldmap'] as $sgqa => $details)
{
if ($details['title'] == $k)
{
$startingValues[$sgqa] = $v;
}
}
}
}
}
$_SESSION['survey_'.$surveyid]['startingValues']=$startingValues;
Expand Down

0 comments on commit 117023d

Please sign in to comment.