moqui / moqui-runtime

The default runtime directory for Moqui Framework
Other
37 stars 79 forks source link

Allow add array to formData #199

Closed chunlinyao closed 2 years ago

chunlinyao commented 2 years ago

When use q-input with multiple enabled, formData.set will comnvert File array to String array. This PR fixed the bug, make multiple file upload work.

jonesde commented 2 years ago

Thank you, this will be very helpful

hellozhangwei commented 2 years ago

I assume you are saying q-file. I tested it with uploading Example Contect and got failure. The error is : "Could not find matching constructor for: org.apache.commons.fileupload.FileItem(ArrayList)"

chunlinyao commented 2 years ago

I assume you are saying q-file. I tested it with uploading Example Contect and got failure. The error is : "Could not find matching constructor for: org.apache.commons.fileupload.FileItem(ArrayList)"

Can you share your form definition and service definition.

hellozhangwei commented 2 years ago

I just added multiple="true" to contentFile field in the UploadExampleContent form in EditExampleContent.xml as following.

                <form-single name="UploadExampleContent" transition="uploadExampleContent">
                    <field name="exampleId"><default-field><hidden/></default-field></field>
                    <field name="contentFile"><default-field><file multiple="true"/></default-field></field>
                    <field name="purposeEnumId"><default-field title="Purpose">
                        <drop-down><entity-options><entity-find entity-name="moqui.basic.Enumeration">
                            <econdition field-name="enumTypeId" value="ExampleContentPurpose"/>
                            <order-by field-name="description"/>
                        </entity-find></entity-options></drop-down>
                    </default-field></field>
                    <field name="locale"><default-field><text-line size="6"/></default-field></field>
                    <field name="submitButton"><default-field title="Add"><submit confirmation="Really Add?"/></default-field></field>
                </form-single>
chunlinyao commented 2 years ago

When add multiple="true", the service parameter type should change to list or object.

Wei Zhang @.***> 于 2022年7月16日周六 下午4:02写道:

I just added multiple="true" to contentFile field in the UploadExampleContent form in EditExampleContent.xml as following.

            <form-single name="UploadExampleContent" transition="uploadExampleContent">
                <field name="exampleId"><default-field><hidden/></default-field></field>
                <field name="contentFile"><default-field><file multiple="true"/></default-field></field>
                <field name="purposeEnumId"><default-field title="Purpose">
                    <drop-down><entity-options><entity-find entity-name="moqui.basic.Enumeration">
                        <econdition field-name="enumTypeId" value="ExampleContentPurpose"/>
                        <order-by field-name="description"/>
                    </entity-find></entity-options></drop-down>
                </default-field></field>
                <field name="locale"><default-field><text-line size="6"/></default-field></field>
                <field name="submitButton"><default-field title="Add"><submit confirmation="Really Add?"/></default-field></field>
            </form-single>

— Reply to this email directly, view it on GitHub https://github.com/moqui/moqui-runtime/pull/199#issuecomment-1186113885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEJN7LLEIXCIQMPPYMYMDVUJUDBANCNFSM53VIFV2Q . You are receiving this because you authored the thread.Message ID: @.***>

hellozhangwei commented 2 years ago

Thanks for clarification!