Legacy Form - Bug and Fix - Error submitting answer where checkboxe list reaches more than 255 charcaters

Permalink 0 0 Browser Info Environment
There is an issue in legacy forms where setting checkbox list and multiple options checked reach more than 255 character limit.

Fix issue with 2 areas edited.
Need Core update done for future releases
1. blocks/form/controller.php
Add the following code just before the insert to btAnswers in the action_submit_form function
<code>
// MeMedia Pry Ltd - Added to move answer to answerlong in greater than allowed limit in DB
if(strlen($answer) > 255){
$answerLong = $answer;
$answer = '';
}
// End MeMedia Pry Ltd

$v=array($row['msqID'],$answerSetID,$answer,$answerLong);
$q="insert into {$this->btAnswersTablename} (msqID,asID,answer,answerLong) values (?,?,?,?)";
</code>

2. single_pages/dashboard/reports/forms/legacy.php
Edit the form report results to show answerlong
Remove the following code at around line 234 to 240
<code>
if ($question['inputType'] == 'text') {
echo '<td>' . $text->entities(
$answerSet['answers'][$questionId]['answerLong']) . '</td>';
} else {
echo '<td>' . $text->entities(
$answerSet['answers'][$questionId]['answer']) . '</td>';
}
</code>
Replace it with
<code>
echo '<td>' . $text->entities(
$answerSet['answers'][$questionId]['answer']) . ' ' . $answerSet['answers'][$questionId]['answerLong'] . '</td>';
</code>


Status: New

concrete5 Environment Information

# concrete5 Version
Core Version - 8.2.1
Version Installed - 8.2.1
Database Version - 20170802000000

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36