Mike. Thanks again for the reply! I can see what you're doing with this code,
and I was sure it would work, but for some reason it doesn't?! No errors,
just left with the same default text again. In fact I added
alert(a[i].value); to your function just to make sure it was working, and
yes, it does contain the updated text, but this is not what gets sent to my
php script. Weird. Can you think of anything else? (problem would appear to
be in the form plugin rather than FCKeditor..?)

Thanks again for your help so far, it's much appreciated.

Matt

ps here's a link to fck in case you're interested:
http://wiki.fckeditor.net/FCKeditor (i know, strange name!)


malsup wrote:
> 
> 
> Hi Matt,
> 
> I don't know anything about the FCKeditor (but somehow it seems
> inappropriate to say its name out loud at work), so I can't imagine
> why it isn't working on the first pass.  However, you can "force" its
> data w/o modifying the plugin by doing something like this (assuming
> the element *name* of the editor is 'editor'):
> 
> var options = {
>     target: '#output1',
>     beforeSubmit: function(a, $f, o) {
>         // force FCK data
>         var val = FCKeditorAPI.GetInstance('editor').GetXHTML(true);
>         for (var i=0; i < a.length; i++) {
>             if (a[i].name = 'editor') {
>                 a[i].value = val;
>                 break;
>             }
>         }
>     }
> };
> 
> Mike
> 
> 
> 
> On 4/30/07, imatts <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi Mike.
>>
>> Thanks for your reply. Just modifying the test in the editor and then
>> clicking submit. The code is very simple:
>>
>> <script type="text/javascript" src="../javascript/jquery.js"></script>
>> <script type="text/javascript"
>> src="../javascript/jquery.form.js"></script>
>> <script type="text/javascript">
>> // prepare the form when the DOM is ready
>> $(document).ready(function() {
>> var options = {
>> target: '#output1', // target element(s) to be updated with server
>> response
>> };
>> // bind form using 'ajaxForm'
>> $('#edit_form').ajaxForm(options);
>> });
>> </script>............
>>
>>
>> ........<form action="processform.php" method="post" id="edit_form">
>> <?php
>> $oFCKeditor = new FCKeditor('editor');
>> $oFCKeditor->BasePath = '/javascript/fckeditor/';
>> $oFCKeditor->Value = 'Default text in editor';
>> $oFCKeditor->Create();
>> ?>
>> <input type="submit" name="save" value="Save Article" id="save" />
>> </form>
>>
>> I've actually got around it temporarily by adding a few lines of code to
>> the
>> jQuery.fn.ajaxSubmit function and a hidden <input> to the form which gets
>> updated with the updated text using this:
>>
>> document.getElementById('updated_text').value =
>> FCKeditorAPI.GetInstance('editor').GetXHTML(true);
>>
>> , but it's an ugly solution really. Unfortunately my javascript knowledge
>> is
>> not that great at the moment to figure out a better solution, maybe
>> someone
>> else can though (I hope).
>>
>> Thanks in advance.
>>
>> Matt
>>
>>
>>
>>
>> malsup wrote:
>> >
>> >
>> > imatts,
>> >
>> > I'm not sure I understand.  Are you manually modifying text in the
>> > editor and then clicking the submit button?  Or are you modifying the
>> > text via JavaScript?  Could you post a page that demonstrates the
>> > problem?
>> >
>> > Mike
>> >
>> >> I've just noticed that if I submit the form again without changing
>> >> anything,
>> >> the modified text is picked up in the $_POST array, on the second try.
>> >> Now
>> >> I'm wondering if there's a way to simulate this update of the input
>> data
>> >> before sending the form, so that it has the correct data on the first
>> >> attempt?
>> >>
>> >>
>> >> > Is there a way to add an element to the array that get posted to the
>> >> > action="example.php"?
>> >> > The form plugin is great, and it sends all the form fields for you,
>> >> easy
>> >> > and quick, but it's not sending the updated text in the edit area.
>> >> >
>> >> > Normally you can get this updated text by doing: var editor =
>> >> > FCKeditorAPI.GetInstance('editor').GetXHTML(true);
>> >> >
>> >> > which is fine, but how do I attach this variable to the $_POSTed
>> ones
>> >> that
>> >> > are in the form? (is there a way to do this using the form plugin?)
>> >> >
>> >> > Any help would be most appreciated!
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/JQuery%2C-Form-plugin-and-FCKeditor-tf3666628s15494.html#a10252612
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/JQuery%2C-Form-plugin-and-FCKeditor-tf3666628s15494.html#a10254244
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to