Is it possible to change textarea name to a name without brackets ?

Currently , the textarea name as seen on html output will be
name= "edit[body]"

Wanting to make it something like editbody as well as at the same time it should be received by drupal validation.

This is necessary for inputs like onclick smili or eot font : eg consider the code

function bhorof(text) { text = '' + text + ''; if (document.form1.edit[body].createTextRange && document.form1.edit[body].caretPos) { var caretPos = document.form1.edit[body].caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; document.form1.edit[body].focus(); } else { document.form1.edit[body].value += text; document.form1.edit[body].focus(); } } If the object is edit[body] there will be consitent js error with IE but making it editbody will give no error. Problem is if it made editbody, drupal wont accept the text input and will be keeping on returning the blank form. Any help please. If there is any plugin ( I could not find one ) that has inline onclick smili ( ie some smilis gifs below or by the side of textarea and by clicking on the smili one gets :) :( etc in the textarea field ) can some one kindly direct me to that link ?

Comments

dman’s picture

You really shouldn't be using your ids in the wild with javascript objects. It works, but that's just because javascript is so cute and forgiving.
It's taken every item in the elements array and made them a form property for easy access. That's old-school, and probably not even ECMA-compliant any more.
It'll bite you one day. Like now.

Yeah, the PHP/Drupal notation of every form ID in an array is a pain sometimes, but change
document.form1.edit[body].value
to
document.form1.elements["edit[body]"].value
... and your problems should vanish.

.dan.

http://www.coders.co.nz/

rizaa’s picture

That was an excellent solution.
You REALLY know javascript very very well.
What took me 48 hours in vain to solve was done by you in a second !!!
Thanks a million.