Two options come to mind:

1) IPE has a handleLineBreaks option which defaults to true. So, always have the server convert newlines to <br/> before sending the text (both in the original page load and in response to a submit) and remove the loadTextURL option (doesn't seem like you need it in this case).

2) IPE uses Ajax.Updater unless evalScripts is true. So, pass an insertion function into ajaxOptions that will convert newlines into <br/> before calling Element.update.
ajaxOptions: {
insertion: function(element,content){ element.update(content.replace(/\\n/gi, "<br/>")); }
}
This won't work if you need evalScripts since IPE in all of it's retardedness uses the same ajaxOptions for both the loadExternalText and the onSubmit... so you can't have separate "parameters", "onComplete"s, etc.. Luckily Ajax.Updater is used by onSubmit so this is ignored by the loadExternalText Ajax.Request. However, if you are using ajaxOptions for loadExternalText this will be really confusing to other people, "Why is he specifying an insertion for an Ajax.Request?"

I'll say it again, IPE needs to be rewritten.

Colin

halla wrote:

Hi,

when using the Scriptacolous Ajax.InPlaceEditor I can use the
"loadTextURL"-Parameter to get a Text from a Database, which should be
displayed in a Form for Editing. After submitting the Form, the same
Text is displayed instead of the Form.

My problem is, that I'd need access to the Text, which is displayed
AFTER submitting the form. Is there a way to alter this text?

Background:
I store the text in the Database without any <br />-Tags, just
"\n"-linebreaks. When retrieving the text from the DB to display it in
the form, this keeps my linebreaks like they should. But after
submitting and showing the same text as "normal" HTML, all my
linebreaks are gone :-(

f.e. in the form, my text looks like this:
1st Row,
2nd Row,
3td Row.
After submitting the InPlaceEditor-Form, the same text is displayed
like this:
1st Row, 2nd Row, 3td Row

Does anybody know how to solve this?
Have a nice day,
Daniel


>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to