Skip to content

Commit 56cc745

Browse files
committed
Merge pull request #4 from sakshityagi/master
Fixed the issue of user not able to type in text box : #118605155
2 parents 59287b1 + 69d62ce commit 56cc745

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

control/content/index.html

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@
1515
ng-show="datastoreInitialized">
1616
<div ng-form="frmMain">
1717

18-
<div class="item clearfix row margi
19-
n-bottom-fifteen">
18+
<div class="item clearfix row margin-bottom-fifteen">
2019
<div class="labels col-md-3 padding-right-zero pull-left">
2120
<span>URL to your PDF</span>
2221
</div>
2322
<div class="main col-md-9 pull-right clearfix">
2423
<div class="col-md-9 pull-left padding-left-zero">
25-
<input id="url" name="url" type="text" class="form-control"
26-
ng-model="data.content.url" ng-change="clearUrl()"
27-
required
28-
pattern="[-a-zA-Z0-9@:%_\+.~#?&amp;//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?!?\/?\w\/?&amp;//=]*)?">
24+
<input id="url" name="url" type="url" class="form-control"
25+
ng-model="data.content.url"
26+
required>
2927
</div>
3028
<div class="col-md-3 pull-right padding-zero">
3129
<button class="btn btn-success stretch" ng-click="validateUrl()"
@@ -102,6 +100,9 @@
102100
} else {
103101
dataChanged = true;
104102
}
103+
if (dataChanged && newObj.content && !newObj.content.url) {
104+
$scope.clearUrl();
105+
}
105106
}, true);
106107

107108
if (!$scope.$$phase && !$scope.$root.$$phase) {
@@ -155,18 +156,16 @@
155156
};
156157

157158
$scope.clearUrl = function () {
158-
if (!$scope.data.content.url) {
159-
$scope.data.content.url = null;
160-
var data = $scope.data;
161-
buildfire.datastore.save(data, function (err, result) {
162-
if (err || !result) {
163-
$log.error('Error saving the widget details: ', err);
164-
}
165-
else {
166-
$log.info('Widget details saved');
167-
}
168-
});
169-
}
159+
$scope.data.content.url = undefined;
160+
var data = $scope.data;
161+
buildfire.datastore.save(data, function (err, result) {
162+
if (err || !result) {
163+
$log.error('Error saving the widget details: ', err);
164+
}
165+
else {
166+
$log.info('Widget details saved');
167+
}
168+
});
170169
};
171170

172171
$scope.openMethodChanged = function () {

widget/index.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ <h2>Success!</h2>
1515
<script>
1616
buildfire.spinner.show();
1717

18-
function dataLoadedHandler(result) {
19-
20-
if (result && result.data && result.id) {
18+
function dataLoadedHandler(result, fromUpdate) {
19+
if (result && result.data && (result.id || fromUpdate)) {
2120
var content = result.data.content;
2221
if (content && content.url) {
2322
buildfire.getContext(function (err, context) {
@@ -44,10 +43,14 @@ <h2>Success!</h2>
4443

4544
buildfire.navigation.goBack();
4645
}
47-
46+
4847
buildfire.spinner.hide();
4948
});
5049
}
50+
else{
51+
var d =document.getElementById("d");
52+
d.style.display='none';
53+
}
5154
} else{
5255
var d =document.getElementById("d");
5356
d.style.display='';
@@ -72,9 +75,9 @@ <h2>Success!</h2>
7275
});
7376

7477
buildfire.datastore.onUpdate(function (result) {
75-
dataLoadedHandler(result);
78+
dataLoadedHandler(result, true);
7679
});
77-
80+
7881
</script>
7982
</body>
8083
</html>

0 commit comments

Comments
 (0)