Hello,
I am using shoutbox module in my project.Also for shoutbox, instead of textarea, I m using Ckeditor.But when I type my post & click on shout it displays an error like "Enter a message".Again,clicking on shout submits my post...& shout gets stored in database.So, For shouting I have to click 'shout' button twice.

The above problem occurs only in mozilla firefox & same works perfectly in IE 8.

Please I request you to please help me to find out the solution for the same as this functionality is very urgent & critical for my work.....Please help me out........Thanks in advance

Comments

Drupality’s picture

Check this issue out. You may make something out of my try : http://drupal.org/node/1071106

rohitraj’s picture

yes...thanks Drupality,

I read ur issue.....i am facing the same problem & am not getting any solution.....I have tried with the "for loop for CKEditor instances" mentioned in your issue....but the problem again is after inserting that for loop ...the shout doesnt get stored in database on fist click.....Again....i have to click twice............
Please help me out....Its very urgent for me.........i m stuck at dat from last 2 days......Please help....
Thanks in advance........

Drupality’s picture

Hi rohitraj,

just a quick update for you:

in the validation handler of the shoutbox javascript file:

for ( instance in CKEDITOR.instances ){
CKEDITOR.instances[instance].updateElement();
}

form.message.value = $(shoutForm).find('#edit-message').val();

works so far. The problem is just. After submitting the form, you'll face a white page. It breaks the callback somehow.

__
Any hint of the author would be appreciated.

Drupality’s picture

Update:

this works just because it breaks the scripts since shoutForm isn't defined in the method itself.
Sorry :(

daudetalphonse’s picture

I don't know if anyone is still interested, but this is how I made it work :

In shoutbox-form.js, towards the end of the file, before the line:
$('#shoutbox-add-form').resetForm();

add:
if (typeof(CKEDITOR) != 'undefined') {
resetFormCK();
}

at the end of the file, add:
function resetFormCK() {
if (typeof(CKEDITOR.instances['edit-message']) != 'undefined') { // check if CKEDITOR is loaded
CKEDITOR.instances['edit-message'].setData('');
}
}
function updateFormCK() {
if (typeof(CKEDITOR.instances['edit-message']) != 'undefined') { // check if CKEDITOR is loaded
CKEDITOR.instances['edit-message'].updateElement();
}
}

And in the file shoutbox.module, change:
// The submit button
$form['wrapper']['submit'] = array(
'#type' => 'submit',
'#value' => t('Shout'),
);

into:
// The submit button
$form['wrapper']['submit'] = array(
'#type' => 'submit',
'#value' => t('Shout'),
'#attributes' => array('onClick' => 'updateFormCK();'),
);

vitalblue’s picture

Issue summary: View changes
Status: Active » Closed (outdated)