Archive

Posts Tagged ‘CodePress’

CodePress gotcha

September 22nd, 2009 No comments

Doing some PHP recently, I had to use CodePress on a form for editing some code “the nice way”. The problem I had was that on submit the content that I was editing didn’t get submitted at all.

It turns out CodePress “replaces” the textarea you’re giving it with some frame that it uses for syntax coloring and stuff (it’s a little more complicated than this, but this is the basic idea). The issue is that in the end, when submitting the form, it forgets to set the text to the original textarea you had on the page. The solution was to disable the nice editor on submit by calling toggleEditor() on it in the onsubmit or onclick handler of the form’s submit control.

Categories: Programming Tags: , ,