0

我在该表单中有一个表单和一个 ng 文件上传控件:

<form name="form" class="form-horizontal" novalidate ng-submit="save(entity)">
<div class="form-body">
    <h3 class="form-section" translate>Info</h3>
    <div class="row">
        <div class="col-md-12">
            <div class="form-group">
                <label class="col-md-2 control-label">{{'Name' | translate}}
                    <span class="required">
                                                *</span>
                </label>
                <div class="col-md-7">
                    <input type="text" placeholder="" ng-model="entity.name[defaultLanguage]" class="form-control" name="name" required="">
                    <span class="has-error help-block" ng-show="form.name.$error.required && form.name.$dirty " translate>Entity name is required.</span>
                </div>
            </div>
        </div>
    </div>
        <div class="row">
            <div class="col-md-12">
                <div class="form-group last">
                    <label class="control-label col-md-2">{{'Video' | translate}}
                        <a uib-tooltip="This video will be displayed inside the application."> <i class="fa fa-question-circle"></i>
                        </a>
                    </label>
                    <div name="file" ng-hide="entity.video" class="direct_upload col-md-7" ngf-drop="uploadVideo($file)" ngf-drag-over-class="{pattern: 'video/mp4', accept:'dragover', reject:'dragovererror', delay:100}" ng-model="video" ngf-multiple="false" ngf-accept="'video/mp4'" ngf-pattern="'video/mp4'" ngf-max-size="'10MB'">
                        <img class="drag-icon" src="img/icons/cloud_upload.png">
                        <h2>{{'Drag & drop here' | translate}}</h2>
                        <h4>{{'to upload, or'| translate}}   <button type="file" name="fileB" ngf-max-size="'10MB'" ngf-select="uploadVideo($file)" ngf-multiple="false" title="upload" ng-model="video" ngf-pattern="'video/mp4'" ngf-accept="'video/*'" translate>browse</button></h4>
                        <div ng-show="video.progress >0;" class="progress progress-striped active">
                            <div class="progress-bar progress-bar-success" style="width: {{video.progress}}%" ng-init="progress=0" role="progressbar"></div>
                        </div>
                        <span class="haserror" ng-show="form.file.$error.maxSize || form.fileB.$error.maxSize" translate>Maximum file size to upload is 10MB</span>
                        <span class="haserror" ng-show="form.file.$error.pattern || form.fileB.$error.pattern" translate>This file type is not supported.</span>
                    </div>
                    <div ng-show="entity.video" class="preview">
                        <div class="row">
                            <imgix data-height="200" data-width="200" url="entity.video"></imgix>
                            <button class="btn btn-danger" type="file" name="fileC" ngf-max-size="'10MB'" ngf-select="uploadVideo($file)" ngf-multiple="false" title="{{'Change' | translate}}" ng-model="video" ngf-pattern="'video/mp4'" ngf-accept="'video/mp4'" translate>Change</button>
                            <a class="btn btn-danger" ng-click="entity.video=null" translate>Remove</a>
                        </div>
                        <span class="haserror" ng-show="form.fileC.$error.maxSize" translate>Maximum file size to upload is 10MB</span>
                        <span class="haserror" ng-show="form.fileC.$error.pattern" translate>This file type is not supported.</span>
                    </div>
                </div>
            </div>
        </div> 
    </div>
</div>
<div class="form-actions">
    <div class="row">
        <div class="col-md-offset-3 col-md-9">
            <button type="submit" class="btn green"  ng-disabled="form.$invalid" translate>Save</button>
            <a class="btn default" back-button translate>Back</a>
        </div>
    </div>
</div>

当我在第一个文本字段中按回车键时,会打开一个文件对话框。

当按下输入键时,我应该如何避免打开文件对话框?

4

0 回答 0