core icon indicating copy to clipboard operation
core copied to clipboard

Form Handler - Default value assigned to multiselect fields is not being displayed as selected when the form is loaded

Open gabbydotCMS opened this issue 14 years ago • 4 comments

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.

gabbydotCMS avatar Jul 06 '12 16:07 gabbydotCMS

ok let us know when you patch it what the fix was.

jtesser avatar Jul 06 '12 16:07 jtesser

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

oswaldogallango avatar Jul 06 '12 17:07 oswaldogallango

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 :)

gabbydotCMS avatar Jul 06 '12 19:07 gabbydotCMS

Tested with multi, radio, checkbox, text, and select... all defaults displaying on form

DeanGonzalez avatar Aug 09 '12 19:08 DeanGonzalez