I have a module that for various reasons changes the value of the comment submit button (just a trivial text change, from 'Save' to 'Post Comment').
This causes the ajax comment submit to through an error (though the comment is still posted).
The cause of this is due to the following in ajax_comments.pages.inc
elseif ($form_state['values']['op'] == t('Save')) {
A way to do the same thing but more generically would be to use the value of $form_state['values']['submit'] since what you want to ensure is that the operation was submit. I've attached a patch that I think it should work but give more flexibility.
Comment | File | Size | Author |
---|---|---|---|
ajax_comments_op_value.patch | 1.21 KB | hadsie | |
Comments
Comment #1
neochief CreditAttribution: neochief commentedFixed in dev. Thanks!
Comment #2
GreenReaperUnfortunately this breaks comment preview for me. The form is submitted and some kind of response is provided by the server but no comment appears. Reverting the change fixes it (the first line changed appears to be the critical one).
Comment #3
neochief CreditAttribution: neochief commentedHey Laurence, could you try to solve the issue somehow (no reverting the code) and get us the patch? I guess you're closest to fix.
Comment #4
mattwmc CreditAttribution: mattwmc commentedI used this mod to change my 'Save' text to 'Submit' - http://drupal.org/project/stringoverrides
Submit and Preview work fine for me.
Comment #5
thaddeusmt CreditAttribution: thaddeusmt commentedThis patch also broke the Preview functionality for me. Reversing it restored the ajax previews.
Comment #6
rjbrown99 CreditAttribution: rjbrown99 commentedIs this still an issue? It seems to be fixed in dev by a quick review of the code. I'm using this with -dev, modifying the button text in a custom module as such:
That works fine for me and comments are submitted properly.
Comment #7
manderson311 CreditAttribution: manderson311 commentedI'm having the same issue with version 6.x-1-8...
I wanted the save buttons text to be blank so that I can use an image instead...
Shouldn't be doing it this way but it works for now...
Line 142 in ajax_comments.module is this
elseif ($form_state['values']['op'] == t('Save')) {
so I modified it to this
elseif ($form_state['values']['op'] == t('Save')|| $form_state['values']['op'] == t('')) {
Comment #9
qzmenkoIssue is closed because 6.x version is unsupported. Feel free to open new issue for 7.x or 8.x versions of module.