View Issue Details

IDProjectCategoryView StatusLast Update
0006764module Visual CMSmodule Visual CMS - subpublic2019-02-21 10:37
ReporterHausenberg_Acando Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.0.0 
Fixed in Version3.3.1 
Summary0006764: Multiple usage of input fields of type image not possible within one widget-form
DescriptionThere can only be used one input field of type image within one form. If one defines more than one input fields of type image within one form and the end-user chooses different images for the different input fields after saving all image input fields have the same image reference. It is the image of the first input field, which is also referenced by the other input fields.

I`d like to provide you my js-file but either .js nor .txt nor .zip files are accepted. You could contact me and I will send you an email.

This is a clone to https://bugs.oxid-esales.com/view.php?id=6763 as you prefer english description and I can`t find an edititng button.

Steps To ReproduceAs there is no standard widget in the core delivery which contains more than one input field of type image, one have to create a new widget with at least two input fields of type image. E.g.

'image_desktop' => array(
                'type' => 'image',
                'label' => $this->trans('SHORTCODE_SERVICE_TEASER_DESKTOP_IMAGE'),
                'preview' => true,
                'validation' => 'required',
                'validationErrorMsg' => $this->trans('SHORTCODE_VALIDATION_REQUIRED'),
            ),
            'image_mobile' => array(
                'type' => 'image',
                'label' => $this->trans('SHORTCODE_SERVICE_TEASER_MOBILE_IMAGE'),
                'preview' => true,
                'validation' => 'required',
                'validationErrorMsg' => $this->trans('SHORTCODE_VALIDATION_REQUIRED'),
            ),

As a next step one has to create the widget via the OXID User Interface. In both image input fields one has to choose two different images. Then save the form. If one then restart the edititing modus, one can already see in the preview that in all cases the same image is being referenced.
Additional InformationI made some changes in the file visualeditor.js to solve this problem. You can overtake my changes and merge it in your developing branch. Of course it should be tested on your site. On our site it works fine.

1) Row 1033
VisualEditor.prototype.serializeInputImages = function ( $target )
    {

        var data = [];

        if ( $target.data( 'multi' ) === '1' )
        {
            $( '.dd-widget-item-col', $target ).each( function ()
                {
                    data.push( $( '.dd-widget-image-item', this ).data( 'file' ) );
                }
            );
        } else
        {
            $($target).each(function (){
                data.push( $( '.dd-widget-item-col .dd-widget-image-item', this ).first().data( 'file' ) );
            })
        }

        return data;
    };

2) Row 1479
if ( $imageList.length )
                        {
                            $imageList.each( function (index)
                                {
                                    var type_match = $( this ).data( 'input-name' ).match( new RegExp( "^" + type + "\\\[([^\\\]]*)\\\](\\\[?)" ) );

                                    if( type_match )
                                    {
                                        params[ type_match[ 1 ] ] = self.serializeInputImages($imageList)[index];
                                    }
                                }
                            );
                        }
TagsNo tags attached.

Relationships

has duplicate 0006763 closedQA Mehrfachverwenung von Bildeingabekomponenten in einem Formular nicht möglich 

Activities

QA

2018-01-15 10:23

administrator   ~0012354

Tested on EE 6.0.0 in OXVM.
Changed the Javascript on the running page.
The fix doesn't solve the problem quite yet.