I have a need to create a Javascript function in Chronoforms that depends on data returned by a query call to a data table. Here is the scenario.
I have a drop down menu that contains titles of images. When the user selects an option, it triggers an onChange event and calls my java script function. The function needs to know the real image file name in order to change the image displayed along side the select menu. Both the image name and the file name are retrieved at the top of the form using an sql query to the appropriate database. So, I need to get the image name associated with the selection to the java script function so it can make the change. The select/option DOM entries only know about the image name because that is the "value" of the selected option. I thought if I could construct an "onload" event function in javascript to initialize a global array that stores the image file names, then I could just reference that global array in the onChange event function. To do this I would have to associate the onLoad function with the body tag of the form, and I don't know how to get to that.
Anybody run into this problem before. Thanks in advance for any help or thoughts.
-Mark
I have a drop down menu that contains titles of images. When the user selects an option, it triggers an onChange event and calls my java script function. The function needs to know the real image file name in order to change the image displayed along side the select menu. Both the image name and the file name are retrieved at the top of the form using an sql query to the appropriate database. So, I need to get the image name associated with the selection to the java script function so it can make the change. The select/option DOM entries only know about the image name because that is the "value" of the selected option. I thought if I could construct an "onload" event function in javascript to initialize a global array that stores the image file names, then I could just reference that global array in the onChange event function. To do this I would have to associate the onLoad function with the body tag of the form, and I don't know how to get to that.
Anybody run into this problem before. Thanks in advance for any help or thoughts.
-Mark