0

I am trying to open a new dialog box which contains a text box where i'll enter the name but when this confirm box is shown the text box is disabled.

Edit

I have a page where i have a button for uploading files. When this button is clicked a bootstrap modal popup is opened where i choose file and upload it to node server backend. After successful upload of file a ngDialog confirm is opened where i have a textbox to enter group name. Problem is when this confirm box is shown the text box is disabled.

My controller code:

myApp.controller('UploadFile',['Upload','$window','ngDialog','$scope',function(Upload,$window, ngDialog, $scope){
    var vm = this;
    vm.submit = function(){ //function to call on form submit
        if (vm.upload_form.file.$valid && vm.file) { //check if from is valid
            vm.upload(vm.file); //call upload function
        }
    }

    vm.upload = function (file) {
        Upload.upload({
            url: '/upload', //webAPI exposed to upload the file
            data:{file:file} //pass file as data, should be user ng-model
        }).then(function (resp) { 
            if(resp.data.error_code === 0){ 
                console.log(resp.data.path);
                $scope.filePath = resp.data.path;
                ngDialog.openConfirm({ template: 'secondTemplate',scope: $scope, closeByDocument : false,controller: 'sendUploadDetailsCtrl' })
                .then(function(value){//when confirm button is clicked.
                    console.log("sent Successfully.");
                    console.log(value);
                }, function(error){//Cancel button is clicked.
                    console.log(error);
                });
            } else {
                $window.alert('an error occured');
            }
        }, function (resp) { //catch error
            console.log('Error status: ' + resp.status);
            $window.alert('Error status: ' + resp.status);
        }, function (evt) {
            console.log(evt);
        });
    };
}]);

And here is the template:

<script type="text/ng-template" id="secondTemplate">
<div ng-controller="sendUploadDetailsCtrl">
    <div class="modal-header">
        <h3>Please enter Group name!</h3>
    </div>
    <div class="modal-body">
        <div>{{filePath}}</div>
        <input type="text" name="groupName" id="groupName" ng-model="uploadGroupName" required />
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" ng-click="ok()">Submit</button>
        <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
    </div>

Now every thing is working fine except textbox inside the controller. ngDialog confirm box is opening. it is showing the scope file path value but the text box is kind of readonly. i can't input any value in it. i don't know what's the problem.

Sid
  • 2,582
  • 4
  • 16
  • 20
  • Do you have any other jQuery code or some other javascript which can disable all or some text box in your page. You can try Chrome Deeveloper tool by inspecting your DOM and put a debug pointer over DOM attribute change. – Partha Sarathi Ghosh May 27 '16 at 05:47
  • Also it may happen your text box color is like disabled, not the text box itself. Text box can not be disabled by CSS. In your code I did not find anything that could make your text box disabled. It may happen your text box is just like disabled color but not originally disabled. – Partha Sarathi Ghosh May 27 '16 at 05:50
  • Textbox is disabled, it is not accepting any value. Maybe it is affected my bootstrap modal popup which is opened before this ngDialog box is opening. Trying to figure out the problem. Updating my question. – Sid May 27 '16 at 05:55
  • Place another text box as `` only. No id, no name, nothing and look at the behavior. If possible place a text area also in same way. – Partha Sarathi Ghosh May 27 '16 at 06:16
  • What was the problem? Please post your answer so that others can learn it form this post. – Partha Sarathi Ghosh May 27 '16 at 17:45
  • It was bootstrap modal popup. I moved the popup form to page and after then confirm box text box is working fine. – Sid May 27 '16 at 19:34

0 Answers0