Form Handler - Default value assigned to multiselect fields is not being displayed as selected when the form is loaded
This is a Show Stopper for Secure Form Project.
Ozzy is still checking what can be causing it. We'll need to apply a hotfix to be able to continue our QA tests.
ok let us know when you patch it what the fix was.
the problem is caused because this piece of code "&& $tempVelocityVar.indexOf('$') == -1" is missing in the multi_select elseif condition showed below
#elseif($field.fieldType == 'multi_select' && !($showOnlyRequiredFields && !$field.isRequired()) ) #if($UtilMethods.isSet($request.getParameter("$field.velocityVarName"))) #set($fieldDefaultValue = $request.getParameterValues("$field.velocityVarName")) #elseif($UtilMethods.isSet($tempVelocityVar)) <-- HERE #set($fieldDefaultValue = $tempVelocityVar ) #else #set($fieldDefaultValue = $field.defaultValue.split('|')) #end
the elseif condition should be like this #elseif($UtilMethods.isSet($tempVelocityVar) && $tempVelocityVar.indexOf('$') == -1)
This is the file /dotCMS/WEB-INF/velocity/static/content/content_form_macro.vtl where the change need to be done
Hi JT, if the patches that we are applying for any of the Form Handler issues we've been reporting is the solution that should make it to the core code, assign the task to me and we'll create the new branch, commit, and do the pull request :)
Tested with multi, radio, checkbox, text, and select... all defaults displaying on form