How to fill formfield with slider value?

Hi there,

I created a toolbar with a slider. I did it that way:

			var toolbar;
			toolbar = new dhtmlXToolbarObject("toolbarObj");
			toolbar.loadXML("./lib/dhtmlx/dhtmlxToolbar/samples/common/dhxtoolbar.xml?etc=" + new Date().getTime());
			function getSliderValue() {
				var value = toolbar.getValue("costs");
				return value;

I am able to show the slider value with such a call:

<input type="button" value="Klick" onclick="alert(getSliderValue());"

Then my current value is shown.
But I am not able to fill a hidden form field with the slider value:

<input id="sv" name="sv" type="text">
     this.form.elements["sv"].value = getSliderValue();

It doesn’t work and I can’t say why…

One more information. In Google Chrome I can see that error message:

Hi, murphy
This issue can arise because your function getSliderValue() is called at moment when toolbar isn’t defined yet