Friday, 18 September 2015

How can we use JQ or JavaScript for a specific field in Odoo v8? | OpenERP

Add id for particular field in XML
than add js code in js file like below:

openerp.module_name = function(instance) {

var QWeb = openerp.web.qweb;
    _t = instance.web._t;

instance.web.FormView.include({
    load_form: function(data) {
        var self = this;
        this.$el.find('#field id').on('change', function() {
            alert( this.value ); // or $(this).val()
            // here put your logic for validation field.
        });
        return self._super(data);
    },

});
};

1 comment: