Skip to content

Commit

Permalink
Fixed issue #3394: Drop down datefield behaving strange when repeated…
Browse files Browse the repository at this point in the history
…ly submitted and a mandatory blocks occur

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@7536 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Aug 27, 2009
1 parent fcffe0e commit 3415b4e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
25 changes: 25 additions & 0 deletions save.php
Expand Up @@ -134,6 +134,31 @@
}
}
}
else
{
// This else block is only there to take care of date conversion if the survey is not active - otherwise this is done in creatInsertQuery
$fieldmap=createFieldMap($surveyid); //Creates a list of the legitimate questions for this survey
$inserts=array_unique($_SESSION['insertarray']);
foreach ($inserts as $value)
{
//Work out if the field actually exists in this survey
$fieldexists = arraySearchByKey($value, $fieldmap, "fieldname", 1);
//Iterate through possible responses
if (isset($_SESSION[$value]) && !empty($fieldexists))
{

if ($fieldexists['type']=='D') // convert the date to the right DB Format
{
$dateformatdatat=getDateFormatData($thissurvey['surveyls_dateformat']);
$datetimeobj = new Date_Time_Converter($_SESSION[$value], $dateformatdatat['phpdate']);
$_SESSION[$value]=$datetimeobj->convert("Y-m-d");
$_SESSION[$value]=$connect->BindDate($_SESSION[$value]);
}
}
}


}
}

// CREATE SAVED CONTROL RECORD USING SAVE FORM INFORMATION
Expand Down
4 changes: 3 additions & 1 deletion scripts/jquery/lime-calendar.js
Expand Up @@ -14,9 +14,10 @@ $(document).ready(function(){
duration: 'fast'
}, $.datepicker.regional[language]);
});
$('.year').change(dateUpdater);
$('.month').change(dateUpdater);
$('.day').change(dateUpdater)
$('.year').change(dateUpdater);
$('.year').change();
});


Expand Down Expand Up @@ -49,6 +50,7 @@ function dateUpdater() {
}
}


function ValidDate(oObject, value) {// Regular expression used to check if date is in correct format
var str_regexp = /[1-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])/;
var pattern = new RegExp(str_regexp);
Expand Down

0 comments on commit 3415b4e

Please sign in to comment.