Commit ce1c575fe6af89a66be705cb661739ffb8affa83
1 parent
e7202f14e2
Exists in
master
validation on upload file
Showing
2 changed files
with
35 additions
and
17 deletions
Show diff stats
pages/registration.html
... | ... | @@ -27,6 +27,7 @@ |
27 | 27 | <div class="form-group"> |
28 | 28 | <label>Phone No: *</label> |
29 | 29 | <input type="number" class="form-control" ng-model="data.number" required> |
30 | + <!-- <label class="error-message f-family" id="invalidNumber">Please enter only numeric value.</label> --> | |
30 | 31 | </div> |
31 | 32 | <div class="form-group"> |
32 | 33 | <label>Email: *</label> |
... | ... | @@ -103,13 +104,18 @@ |
103 | 104 | </div> |
104 | 105 | <div class="form-group"> |
105 | 106 | <label>Attach Pitch Deck: *</label> |
106 | - <input type="file" class="form-control-file" ng-model="data.uploadFile" id="filePicker" accept=".png, .jpg, .jpeg, .pdf, .ppt"> | |
107 | + <input type="file" class="form-control-file" valid-file ng-model="data.uploadFile" required id="filePicker" accept=".png, .jpg, .jpeg, .pdf, .ppt"> | |
107 | 108 | <span ng-show="fileSelect" class=form-group-text>Please Select a File</span> |
108 | 109 | </div> |
109 | 110 | <div class=form-group-text> |
110 | 111 | Fields marked with "<b>*</b>" are mandatory. |
111 | 112 | </div> |
112 | 113 | </div> |
114 | + <div class="clearfix"></div> | |
115 | + <div class="text-center"> | |
116 | + <input type="submit" class="btn submit-button-form" ng-disabled="applicantForm.$invalid" value="Submit" ng-click="submit()"> | |
117 | + </div> | |
118 | + </div> | |
113 | 119 | <!-- <div class="col-xs-12 col-md-6 input-wrapper" > |
114 | 120 | <div id="snackbar">Error ! Please fill in all fields.</div> |
115 | 121 | <div class="icon-circle-c"> |
... | ... | @@ -263,16 +269,16 @@ |
263 | 269 | <i class="material-icons coupen-approved" style="color:red;" ng-if="tokencheck == false">close</i> |
264 | 270 | <button type="button" ng-click="tokenCall(data.referalToken)" class="pull-right apply-coupen-btn">Apply</button> |
265 | 271 | </div> --> |
266 | - <div class="clearfix"></div> | |
272 | + <!-- <div class="clearfix"></div> --> | |
267 | 273 | <!-- </div> --> |
268 | 274 | <!-- close step-one-form --> |
269 | 275 | <!-- </td> |
270 | 276 | </tr> |
271 | 277 | </table> --> |
272 | - <div class="text-center"> | |
273 | - <input type="submit" class="btn submit-button-form" ng-disabled="applicantForm.$invalid" value="Submit" ng-click="submit()"> | |
278 | + <!-- <div class="text-center"> | |
279 | + <input type="submit" class="btn submit-button-form" ng-disabled="applicantForm.$invalid || filePicker" value="Submit" ng-click="submit()"> | |
274 | 280 | </div> |
275 | - </div> | |
281 | + </div> --> | |
276 | 282 | <!-- CLOSE form-all --> |
277 | 283 | <!-- </div> --> |
278 | 284 | <!-- <div class="clearfix"></div> |
... | ... | @@ -280,9 +286,6 @@ |
280 | 286 | <input type="submit" class="btn submit-button-form" ng-disabled="applicantForm.$invalid" value="Submit" ng-click="submit()"> |
281 | 287 | </div> --> |
282 | 288 | </div> |
283 | - <div class="text-center"> | |
284 | - <input type="submit" class="btn submit-button-form" value="Submit" ng-click="click()"> | |
285 | - </div> | |
286 | 289 | <!-- col-xs-12 col-md-8 col-md-offset-2 --> |
287 | 290 | <!-- <footer> |
288 | 291 | <img id="footer" class="img-responsive banner"> | ... | ... |
script.js
... | ... | @@ -68,6 +68,21 @@ |
68 | 68 | scotchApp.constant("BASE_URL", "http://35.154.24.158:4001/v1") |
69 | 69 | //scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/v1") |
70 | 70 | |
71 | + scotchApp.directive('validFile',function(){ | |
72 | + return { | |
73 | + require:'ngModel', | |
74 | + link:function(scope,el,attrs,ngModel){ | |
75 | + //change event is fired when file is selected | |
76 | + el.bind('change',function(){ | |
77 | + scope.$apply(function(){ | |
78 | + ngModel.$setViewValue(el.val()); | |
79 | + ngModel.$render(); | |
80 | + }) | |
81 | + }) | |
82 | + } | |
83 | + } | |
84 | + }) | |
85 | + | |
71 | 86 | // create the controller and inject Angular's $scope |
72 | 87 | scotchApp.controller('mainController', function($scope, $http, $window, $location, $route, $rootScope, BASE_URL, Analytics) { |
73 | 88 | $scope.data = { |
... | ... | @@ -645,6 +660,7 @@ |
645 | 660 | $scope.data.city = localStorage.getItem("city"); |
646 | 661 | // console.log("HERE===",$scope.data.city ); |
647 | 662 | // }); |
663 | + | |
648 | 664 | var handleFileSelect = function(evt) { |
649 | 665 | var files = evt.target.files; |
650 | 666 | var file = files[0]; |
... | ... | @@ -657,7 +673,13 @@ |
657 | 673 | $scope.base64textString = btoa(binaryString); |
658 | 674 | //console.log("base64textarea",$scope.base64textString) |
659 | 675 | $scope.data.uploadFile = file.name; |
660 | - }; | |
676 | + $scope.fileSelect = false; | |
677 | + if($scope.data.uploadFile == null){ | |
678 | + $scope.fileSelect = true; | |
679 | + }else{ | |
680 | + $scope.fileSelect = false; | |
681 | + }; | |
682 | + } | |
661 | 683 | |
662 | 684 | reader.readAsBinaryString(file); |
663 | 685 | } |
... | ... | @@ -716,12 +738,6 @@ |
716 | 738 | |
717 | 739 | $scope.submit = function() { |
718 | 740 | |
719 | - $scope.fileSelect = false; | |
720 | - if($scope.data.uploadFile == null){ | |
721 | - $scope.fileSelect = true; | |
722 | - }else{ | |
723 | - $scope.fileSelect = false; | |
724 | - $scope.ticketAmnt = 500; | |
725 | 741 | // if($scope.tokencheck == false){ |
726 | 742 | // $scope.data.referalToken = null; |
727 | 743 | // } |
... | ... | @@ -730,6 +746,7 @@ |
730 | 746 | // setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); |
731 | 747 | // }else if($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { |
732 | 748 | $scope.infoForm = true; |
749 | + $scope.ticketAmnt = 500; | |
733 | 750 | $scope.detail = {}; |
734 | 751 | $scope.data.phone = "+91"+$scope.data.number; |
735 | 752 | // if($scope.data.referalToken == null){ |
... | ... | @@ -854,8 +871,6 @@ |
854 | 871 | }, function myError(error) { |
855 | 872 | |
856 | 873 | }); |
857 | - | |
858 | - } | |
859 | 874 | |
860 | 875 | // }) |
861 | 876 | ... | ... |