vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

form.$dirty not working #579

Open ekazaltzis opened 7 years ago

ekazaltzis commented 7 years ago

Hi,

The form.$dirty is always false even though I have touched elements for that form. Is this known issue or am I missing something?

`

       <td>
            <span  editable-text="contact.title" e-name="title" e-form="rowform" e-placeholder="Enter title">{{ contact.title }}</span>
        </td>
        <td>
            <span e-ng-keydown="checkTabEvent($event, $index, rowform)" editable-text="contact.name" e-required="true" e-name="name" e-form="rowform" e-placeholder="Enter name">{{ contact.name }}</span>
        </td>
        <td>
            <form editable-form name="rowform" onaftersave="save(rowform)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="newRecordIndex == $index">
                <div class="buttons" ng-show="rowform.$visible">
                    <button type="submit" ng-disabled="rowform.$waiting" class="btn btn-primary btn-xs" tooltip-placement="top" uib-tooltip="Submit"><i class="fa fa-check" aria-hidden="true"></i></button>
                    <button type="button" ng-disabled="rowform.$waiting" class="btn btn-danger btn-xs" tooltip-placement="top" uib-tooltip="Cancel"><i ng-click="cancel($index, rowform)" class="fa fa-ban" aria-hidden="true"></i></button>
                </div>
            </form>
            <div class="buttons" ng-show="!rowform.$visible">
                <button class="btn btn-primary btn-xs" tooltip-placement="top" uib-tooltip="Edit record"><i ng-click="rowform.$show()" class="fa fa-pencil" aria-hidden="true"></i></button>    
                <button class="btn btn-danger btn-xs" tooltip-placement="top" uib-tooltip="Delete record"><i ng-click="remove($index)" class="fa fa-trash" aria-hidden="true"></i></button>
            </div>  
        </td>
    </tr>

` in the save method of the controller the attribute rowform.$dirty is always false. If I inspect the html element then I see that the element is set to dirty but the form stays pristine.

Any help appreciated

Regards, Emanouil

ckosloski commented 7 years ago

The way xeditable handles forms I think prevents $dirty from working. See if this comment helps you.