htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0:
Naming a textarea name a digit doesn't work


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


PCTuneUpPros
New User

Nov 24, 2004, 10:32 PM

Post #1 of 3 (1730 views)
Shortcut
Naming a textarea name a digit doesn't work Can't Post

Hi everyone,

I'm implementing htmlarea into an existing shopping cart script to allow the user to use htmlarea when adding a description to a product. I struggled forever to get it to work... Finally I discovered that when I do not center the textarea it works fine. Also I had to change the name of the textarea from a single digit to letters. That would seem like no big deal but the script uses this name to process the input elsewhere. Is there any way to make htmlarea to allow me to name the textarea name "4"? See example below changes are in red:



<HEAD>
<script language="Javascript1.2"><!-- // load htmlarea
_editor_url = ""; // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// --></script>
</HEAD>

DOESN'T WORK

<td><textarea cols="40" rows="10" name="4"></textarea></td>
<script language="JavaScript1.2" defer>
editor_generate('4');
</script>

WORKS

<td><textarea cols="40" rows="10" name="y4"></textarea></td>
<script language="JavaScript1.2" defer>
editor_generate('y4');
</script>

Thanks, Mark


(This post was edited by PCTuneUpPros on Nov 25, 2004, 4:03 AM)


Luis
Veteran

Nov 25, 2004, 1:08 PM

Post #2 of 3 (1697 views)
Shortcut
Re: [PCTuneUpPros] Naming a textarea name a digit doesn't work [In reply to] Can't Post

Hi PCTuneUpPros:

It seems to be an issue with the syntax of the document.all references in editor.js.

All references to the objname using document.all are enclosed inside square brackets, therefore the script is interpretating the objname ("4") as the object index, instead of the object name. This is what the all collection reference at MS website says:

vIndex

Required. Integer or string that specifies the element or collection to retrieve. If this parameter is an integer, the method returns the element in the collection at the given position, where the first element has value 0, the second has 1, and so on. If this parameter is a string and there is more than one element with the name or id property equal to the string, the method returns a collection of matching elements.

What's the solution?

You need to change all references to document.all[objname] in editor.js to use parentheses instead of square brackets. Here are some examples:

document.all[objname].config change to document.all(objname).config
document.all[objname].value = contents; change to document.all(objname).value = contents;
document.all["_" +objname + "_editor"] change to document.all("_" +objname + "_editor")


I hope this helps and greetings.


Don't give up!!
http://webstationone.com/test/htmlarea


PCTuneUpPros
New User

Nov 25, 2004, 3:36 PM

Post #3 of 3 (1691 views)
Shortcut
Re: Thank you Luis! [In reply to] Can't Post

Luis,

Just wanted to say thank you for saving my last strands of hair (I had already pulled out most trying to figure this out!). I made the changes as you explained and it works perfectly now.

Thanks again,

Mark

 
 
 


Search for (options)