我正在尝试在下面的字段添加验证我收到错误消息但它仍然让我保存字段,我不知道我错在哪里请帮助..
到目前为止尝试过代码......
validate.html
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: powerpc64le-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_0.11.1 rCharts_0.4.5
loaded via a namespace (and not attached):
[1] codetools_0.2-8 digest_0.6.8 grid_3.1.1 htmltools_0.2.6
[5] httpuv_1.3.2 lattice_0.20-29 mime_0.3 nabor_0.4.4
[9] plyr_1.8.1 R6_2.0.1 Rcpp_0.11.5 RJSONIO_1.3-0
[13] tools_3.1.1 whisker_0.3-2 xtable_1.7-4 yaml_2.1.13
validate.js
<form name="createProcessFormName"
name="form" role="form" class="form-horizontal"
kendo-validator="validator" k-validate-on-blur="false"
k-options="myValidatorOptions" ng-submit="validate($event) && createProcessFormName.$invalid">
<div class="col-md-7">
<div multiselect-dropdown-tree ng-model="nonPersistentProcess.geoLocations" ng-class="{'disabled': disableGeoLocations}" disable-children="true" options="treeviewOptions"></div>
<p class="status" ng-show="geoLocationRequired">*GeoLocation is required field*</p>
</div>
<button require-control-point="PROCESS_ADD"
ng-hide="editMode" class="btn btn-primary pull-right" type="button"
ng-click="validate($event)">Save</button>
答案 0 :(得分:0)
尝试将if条件更改为:
if(!$scope.nonPersistentProcess.geoLocations.length || !$scope.nonPersistentProcess.epcfKey || !$scope.nonPersistentProcess.legalEnty || !$scope.nonPersistentProcess.erhKey)