cancel
Showing results for 
Search instead for 
Did you mean: 

Calling javascript within tableview model

Former Member
0 Kudos

Hi,

I am building a table using HTMLB. I need to call a javascript function within a <td>. The javascript formats the date. While adding to the Vector I add the cell content as

row.addElement("<script language=\"javascript\">dwColDateTime(new Date("date"));</script>");

Where date is a string.

In my JSP I have the following javascript function

<script language ="javascript">

function dwColDateTime(dt){

fdate = new Date(dt.getTime() + zonediff);

document.write(fdate);

}

</script>

When my table shows up, it shows the content of <td> as it is ie,

<script language="javascript">dwColDateTime(new Date(2004,2,19,08,45,0));</script>

Without HTMLB the javascript works fine.

How do I call the javascript function from within my cell in TableView?

Any ideas will be highly appreciated.

Thanks

lakshmi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Used encode() method to encode my Javascript before adding to the table and it worked fine.

Lakshmi

Former Member
0 Kudos

I think the htmlb control escapes the html code you've added (don't know if there is any way to avoid this).

If possible, it would be best to move the javascript code to the java dynpage code instead, avoid the problem alltogether