Click to See Complete Forum and Search --> : problem with innerhtml


sandu_ada
09-17-2003, 06:54 AM
hi all,

i am developing an application in struts and javascript.
i am creating a layer and then i am trying to insert a combobox in it.

the reason why i am creating a separate layer for each control is that i want the elements to be draggable.

the code is:

var cod = document.cbe.createElement("DIV");//i have a createElement() method for cbe for creating a layer
cod.cbe.innerHtml('<html:select name="employeeForm" property="mycombo" onchange="pass(this.options[this.selectedIndex].value)">
<html:options collection="mycombo" property="id" labelProperty="description"/>
</html:select>
');


the error i get is :unclosed string literal.

Khalid Ali
09-17-2003, 08:16 AM
this should work

cod.cbe.innerHtml('<html:select name="employeeForm" property="mycombo" onchange="pass(this.options[this.selectedIndex].value)">'+
'<htmlptions collection="mycombo" property="id" labelProperty="description"/></html:select>');

sandu_ada
09-17-2003, 11:32 PM
hi Khalid,

I tried your way but still getting the error as

unterminated string literal at

+'<option value="1">Red</option>

Actually the struts code

<html:options collection="mycombo" property="id" labelProperty="description"/>

gets transformed into html as:

<option value="1">Red</option>
<option value="2">Blue</option>

where Red,Blue etc are the elements of the collection mentioned above.

How to rectify this error.

regards,
Sandhya

Khalid Ali
09-17-2003, 11:46 PM
always post the complete part of the code that is in question and is causing error...so that I or some one else for tat matter can take a look..:-)