I am using FCKeditor. Before saving the data of the editor control, I am checking the length of the text entered by the user in javascript.
The problem I am getting is, When i enter the data 1st time and click on the submit button if it exceeds the max limit that I have set gets the proper message for displaying the error message(I am handling this using Custom Validation in ASP.NET so page doesn't postback), now after getting the error message if I change the text in the editor control it displays the previously entered text not the changed text.
The problem I am getting is, When i enter the data 1st time and click on the submit button if it exceeds the max limit that I have set gets the proper message for displaying the error message(I am handling this using Custom Validation in ASP.NET so page doesn't postback), now after getting the error message if I change the text in the editor control it displays the previously entered text not the changed text.
Re: Data not getting changed after changing the text in control.
It seems that if you are using javascript on your form and trying to do something with the data in FCKEditor, it always requires two clicks of the "submit" button. I had this problem when trying to verify the user entered in data by checking if the textarea had any text. I also had this with an AJAX preview/save script that I created.
While I don't have a solution yet, the problem comes from how FCKEditor creates your form inputs. There are two hidden fields and then an iFrame. One of the hidden fields is named the name that you used when creating an instance of the editor. So, when you click submit, you are submitting the value of that hidden field, not the value of FCKEditor. But once that submit is sent, FCKEditor changes the value of that hidden field, so the second time you hit submit, it now has the value that you really want.
This problem only happens (as far as I've encountered) when you are using javascript in submitting your form. In specifics, I am using the onclick event for my submit button.
So no solutions, but if anyone has one please let us know because this is a real problem for me.
Re: Data not getting changed after changing the text in control.
Basically for my onclick event I added the code:
This was on top of my code that ran a javascript when clicked. So my submit button now looks like:
The important part for me to have it working was doing the "fake" submit first and then running my script right after. The first submit makes it so FCKEditor populates the hidden input field that has the ID that I set before. The second submit (my get code) can now access the text that I just typed in since its stored in the hidden field.
This should probably help you and others come up with a solution to similar problems. There may be a better way of doing this but it works for me, for now. I've only tested it in FireFox 3.