niklasvh / feedback.js

Feedback form with screenshot
http://experiments.hertzen.com/jsfeedback/
Other
870 stars 196 forks source link

Send more data in the feedback #15

Open Digitaldaigor opened 11 years ago

Digitaldaigor commented 11 years ago

How i have to do to send more external data in the feedback?

For now i have make this change on the code:

window.Feedback.Form.prototype.data = function() {

if ( this._data !== undefined ) {
    // return cached value
    return this._data;
}

var i = 0, len = this.elements.length, item, data = {};

for (; i < len; i++) {
    item = this.elements[ i ];
    data[ item.name ] = item.element.value;
}

$('*[id^="feedback_"]').each(function(){
    name = $(this).attr('id');
    name = name.replace(/feedback_/,'');
    data[ name ] = $(this).val();
});

// cache and return data
return ( this._data = data );
};

Thanks!