Ticket T725757
Visible to All Users

FileUploader - "Property 'submit' does not exist on type 'NgForm'. Did you mean 'ngSubmit'?" occurs on an attempt to call the submit method

created 6 years ago

Hello supporters.
I have try to use your demo "https://js.devexpress.com/Demos/WidgetsGallery/Demo/FileUploader/FileSelection/Angular/Light/", but  in updateClick method I can not use this.form.submit() action. I have got this message "error TS2551: Property 'submit' does not exist on type 'NgForm'. Did you mean 'ngSubmit'?"

I have an own project and want to use you file uploader.

Thanks for answer.

Best regards.

Jiri Vesely

Show previous comments (1)
    Alisher (DevExpress Support) 6 years ago

      Hello Jiri,

      >>I have got this message "error TS2551: Property 'submit' does not exist on type 'NgForm'. Did you mean 'ngSubmit'?"
      I was unable to reproduce this issue by using Google Chrome Version 73.0.3683.75 (Official Build) (64-bit) and the https://js.devexpress.com/Demos/WidgetsGallery/Demo/FileUploader/FileSelection/Angular/Light/ demo. Would you please modify the demo or prepare a simple project illustrating this error?

      >>https://codesandbox.io/s/xpnpj16yw - not working
      This example is not working because of the CORS policy which is not directly related to our components. Open the browser's console to check for errors.

      In general, you should be able to submit a form by setting the button's type option to submit as described in the Submit the form with ngSubmit article. In our Button widget, the "type" property is used to style the widget in a different manner. However, the type option of an internal element can be set automatically by specifying that the useSubmitBehavior property is set to true:

      HTML
      <dx-button id="button" text="Update profile" [useSubmitBehavior]='true' type="success" (onClick)="updateClick()"> </dx-button>

      Please try this approach and let me know of your results.

      Thanks,
      Alisher

        I have use:
        <dx-file-uploader
        #fileUploader
        [uploadUrl]="uploadUrl"
        selectButtonText="Select file"
        labelText=""
        accept="*"
        uploadMode="useButtons"
        [allowedFileExtensions]="['.xls','.png']"
        [uploadHeaders]="headers"
        [multiple] ="false"
        ></dx-file-uploader>

        on background method
             [HttpPost, DisableRequestSizeLimit]
                public async Task<ActionResult> UploadFile() {
                    IFormFileCollection files = Request?.Form?.Files;
                    if (_uow != null && files != null && files.Any()) {
                        ClientBll clientBll = new ClientBll(_uow);
                        foreach (IFormFile file in files) {
                            await clientBll.Import(file);
                        }
                    }
                    return Ok();
                }

        I have get:
        Request.Form.Files ; Files = null, Request?.Form?.Files = the function evaluation requires all threads  to run

        Answers approved by DevExpress Support

        created 6 years ago (modified 6 years ago)

        I have fixed my problem. Ticket can be closed. Thank you for quick responses.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.