Closed chris68 closed 10 years ago
The following code change (the return false) in kv-markdown.js fixed the problem:
$(input).blur(function() {
$(editor).removeClass('active');
});
$(preview).click(function() {
togglePreview(params);
return false; // Need to cancel the event - otherwise the button submits the form!!!!
});
$(save1).click(function() {
genSaveFile('', params.saveHeader, $(input).val(), 'Text', params.saveText, params.url, params.nullMsg);
});
The following code change ( the $options['form'] = ) in MarkdownEditor.php fixed the problem with the other buttons:
if ($markup) {
$options['onclick'] = 'markUp(' . $btn . ', "#' . $this->inputOptions['id'] . '")';
$options['form'] = 'markup'; // Refer to some non-existent form to disable the form submit
}
However, this is just a hack. Could/should be done better with returning false....
Thanks for reporting. This will be resolved shortly. Does not need a javascript change... just a minor widget parameter change (need to explicitly set button type
= button
for the toolbar buttons -- HTML defaults it to submit
).
Resolved via commit 48837f9 and b38ed74
Works like charm. Thanks for the quick fix. And good to know about the defaults to submit thing....
The markdown editor does not really work inside an ActiveForm; whenever I press the save or preview button, the whole form submits.
Config
View