ivirabyan / jquery-mentions

Adds mentioning support to your text fields.
http://ivirabyan.github.io/jquery-mentions/
MIT License
114 stars 49 forks source link

Removes name attribute of textarea field #28

Closed avdept closed 9 years ago

avdept commented 9 years ago

I have faced strange behaviour of this plugin. I have code like following

$('.wiki-edit').mentionsInput({source: function(request, response){
        project_id = $('form').first().attr('action').replace( /\/projects\//, '' );
        project_id = project_id.replace( /\/search/, '' );
        $.ajax({
            url: '/mention/search',
            data: {'search_tag': request, project_id: project_id},
            success: function(result) {
                response(result['users'])
            }
        });
    }});

In my .wiki-edit textarea i have name like issues[note] - thats original source. However when i use mentionsInput(), it removes name from my textarea, and creates new hidden input with same name. I could copy text before form submit, but i have many views, and therefore many inputs with different names, so it'd take alot of time to fix it. Is there any way to keep input name?

ivirabyan commented 9 years ago

Hidden input contains marked up text, whereas textarea contains raw text, without any signs of mentions. So, contents from the hidden input must be sent to the server, that's why the name attribute moved to it. Why do you want to submit contents of textarea, not of the hidden input?

avdept commented 9 years ago

Not sure why, but when i was submitting my form, i was missing all data from hidden field. It either didn't copy, or something else. I've changed sources to match my needs. Closing this