()
| 475 | // If the dropzone is already a form, only the input field and button are returned. Otherwise a complete form element is provided. |
| 476 | // This code has to pass in IE7 :( |
| 477 | getFallbackForm() { |
| 478 | let existingFallback, form; |
| 479 | if ((existingFallback = this.getExistingFallback())) { |
| 480 | return existingFallback; |
| 481 | } |
| 482 | |
| 483 | let fieldsString = '<div class="dz-fallback">'; |
| 484 | if (this.options.dictFallbackText) { |
| 485 | fieldsString += `<p>${this.options.dictFallbackText}</p>`; |
| 486 | } |
| 487 | fieldsString += `<input type="file" name="${this._getParamName(0)}" ${ |
| 488 | this.options.uploadMultiple ? 'multiple="multiple"' : undefined |
| 489 | } /><input type="submit" value="Upload!"></div>`; |
| 490 | |
| 491 | let fields = Dropzone.createElement(fieldsString); |
| 492 | if (this.element.tagName !== "FORM") { |
| 493 | form = Dropzone.createElement( |
| 494 | `<form action="${this.options.url}" enctype="multipart/form-data" method="${this.options.method}"></form>` |
| 495 | ); |
| 496 | form.appendChild(fields); |
| 497 | } else { |
| 498 | // Make sure that the enctype and method attributes are set properly |
| 499 | this.element.setAttribute("enctype", "multipart/form-data"); |
| 500 | this.element.setAttribute("method", this.options.method); |
| 501 | } |
| 502 | return form != null ? form : fields; |
| 503 | } |
| 504 | |
| 505 | // Returns the fallback elements if they exist already |
| 506 | // |
no test coverage detected