Hi,
Is there any way to get FCKEditor to work properly with JS form validation?
I want to verify that the editor value is not empty when I submit the form, but as the hidden editor field is not set until after my onsubmit() code I always get a 'field empty' error & have to submit the form twice get past the validation.
Is there any way to get FCKEditor to work properly with JS form validation?
I want to verify that the editor value is not empty when I submit the form, but as the hidden editor field is not set until after my onsubmit() code I always get a 'field empty' error & have to submit the form twice get past the validation.
RE: Javascript form validation
RE: Javascript form validation
Add an onSubmit event at your html-form-tag.
<form onSubmit="letsdosth()">
The called function calls the function setFieldValue() (js/fck_editor.js Line:207) so that the value from the textarea is now in the hidden field of the editor. After that you can check if the hidden field is empty or not.
Please consider that the editor is loaded in an IFrame, so that you have to call the setFieldValue fuction with parent.frames['frame_'+YOUR INSTANCE NAME]. (I guess that you have to do so also with the hidden field)