[ome-devel] making javascript work in the HTML templates

august august at develop.ment.org
Sun Jul 30 16:47:23 BST 2006


> This javascript code works fine but when we pasted it
> in one of the .tmpl file for OME it doesn't.
> Any ideas?

With javascript in webbrowsers, there is practically unlimited
possibilities for things to go wrong.

Where are things going wrong?

First, are you sure that the function "addColumn" is being called at
all?

Just put an "alert('hello')"  in there and see if that gets called when
you click the button.   If not, then you might have to put the script
declaration somewhere else, perhaps after the form declaration.

Also, if the script is called and the problem is elsewhere, it might be
that "workset" is inside a 'div' or some other element and the path is
wrong.   so, instead you might try:

	hi = document.forms['workset'].column1_name.value;

-august.


> 
> Thanks.
> 
> <script type = "text/javascript">
> 
> function addColumn(workset)
> {
>     hi = document.workset.column1_name.value;
>     alert("Hi" + hi);
> }
> 
> </script>
> 
> <form name="workset">
>          <input id='yid' type="text"
> name="column1_name">
>          <input type="button" value="Add Column" 
> onClick="addColumn(workset)">
> </form>



More information about the ome-devel mailing list