Link to home
Start Free TrialLog in
Avatar of ncw
ncw

asked on

Javascript errors

I'm getting a javascript error with the following code, but I can't see what's wrong with either the uncommented or with the commented out lines (it's being used with htmlArea3):

<script language="JavaScript1.2" defer>
//fieldname2="products_off_page_text[' . $languages[$i]['id'] . ']'";
//editor_generate(fieldname2);
editor_generate('products_off_page_text[<?php echo $languages[$i]['id']; ?>]');
</script>

Any clues please?
Avatar of archrajan
archrajan

check this
<script language="JavaScript1.2" defer>
//fieldname2="products_off_page_text[' . $languages[$i]['id'] . ']'";
//editor_generate(fieldname2);
editor_generate("products_off_page_text[<?php echo $languages[$i]['id']; ?>]");
</script>
Avatar of ncw

ASKER

Just tested it but there's no change.
perhaps, its difficult as I do not know what is being output.

<script language="JavaScript1.2" defer>
fieldname2="products_off_page_text[\' . $languages[$i]['id'] . \']'";
editor_generate(fieldname2);
editor_generate("products_off_page_text[<?php echo $languages[$i][\'id\']; ?>]");
</script>
Avatar of ncw

ASKER

I guess it could be a bug in the generated output code (htmlArea).
Avatar of ncw

ASKER

Don't think there was anything wrong with the code except it was not required, think it was for htmlarea2 and not version 3
does this

  editor_generate("products_off_page_text[<?php echo $languages[$i]['id']; ?>]");
need single quotes around the element ... so something like
  editor_generate("products_off_page_text['<?php echo $languages[$i]['id']; ?>']");

so if $languages[$i]['id']="bob";
output would be
  editor_generate("products_off_page_text['bob']");
instead of
  editor_generate("products_off_page_text[bob]");
Avatar of ncw

ASKER

HtmlArea 2 in osCommerce works fine with the following code with no double quotes:

editor_generate('products_description[<?php echo $languages[$i]['id']; ?>]',config);

The reason for the js error was that HtmlArea version 3 doesn't require this function call, at least not in the location I had it.
 
Avatar of ncw

ASKER

Thank you for your comments, however I've requested that this question be deleted since I've solved the issue.
ASKER CERTIFIED SOLUTION
Avatar of RomMod
RomMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial