views:

113

answers:

4

Im using a code editor codepress in all of my textareas, but no textarea return a value. I think the different name and id is the problem. Example:

<textarea name="content_text" rows="20" cols="50" class="codepress sql" id="myCpWindow"></textarea>

I have read somewhere in here to use a hidden input to transfer the textarea's value, but i cant do it myself!

ayhelp?

A: 

= drop the id.

Why are your names and id different? (you shouldn't do that in general btw). I assume you're using the name for your stuff and just taking the id because it was on their stuff. While i've never used codepress, most scripts like this (at least, well built ones) will build off of the class (and not the ID) so go ahead and drop the id and see if that works. cheers.

Jason
I don't think that's the answer and I very much disagree that names and IDs shouldn't be different. ID is unique, name is not.
Josh
I have already tried this. Not working.
XLNT - I missed the difference between ID and NAME
Dave
A: 

You need to call textarea_id.getCode()

So you probably want something like this:

<form action="something" onsubmit="this.content_hidden = content_text.getCode();">
<input type="hidden" name="content_hidden">
<textarea name="content_text" rows="20" cols="50" class="codepress sql" id="myCpWindow"></textarea>
<input type="Submit">
</form>
Josh
content_hidden return empty,too. :(I try as well onsubmit="this.content_hidden = textarea_id.getCode();"
A: 

Both answers didnt work...

In the support forum of codepress i found this:

<input type="submit" onclick="textareaID.textarea.value = textareaID.getCode();" value="save" />  

but i cant understand.

Here is the link of discution

A: 

no onsubmit you just need to turnoff the codepress

<form action="something" onsubmit="content_text.toggleEditor();">
  <textarea name="content_text" rows="20" cols="50" class="codepress sql" id="myCpWindow">  
  </textarea>
  <input type="Submit">
</form>
BelmonduS