getBand(0) returns a Band object. You call getCenterVisibleDate on that which 
returns a Javascript Date object.
You will need to convert that to a string before it can be sent back to the 
server.

It should be like this:

tl.getBand(0).getCenterVisibleDate().dateFormatAsString()

where dateFormatAsString is a function that takes a Javascript Date object and 
returns a string like:
"2011-06-23T12:34:00" or whatever format you need to send to your server.

There are many date-formatting libraries available for Javascript. See the 
DateJS library at: http://www.datejs.com
It has a formatter called .toISOString() which does exactly this.

Since you are submitting via POST rather than GET in your form, you shouldn't 
be adding parameters to the form's action attribute. Rather, you should be 
using the form's element values themselves as the data for the post. Include a 
<input type="hidden" name="center" id="center" value=""/> in your <form>.
Add a scroll listener to automatically update the hidden input anytime the user 
scrolls:

tl.getBand(0).addOnScrollListener(function(band) {
        var centerDate = band.getCenterVisibleDate();
        document.getElementById("center").value = 
centerDate.dateFormatAsString();
});


--Mike 



On Jun 22, 2011, at 4:49 PM, Jeff Roehl wrote:

> One thing I need to do is send:
> 
> tl.getBand(0).band.getCenterVisibleDate();
> 
> Back  to the back-end in a <form> post. This way I can keep the timeline  at 
> the 
> same location it was when the data was posted. So the user doesn't have to 
> constantly be scrolling back to the place they where  before.
> 
> I tried the following, but it doesn't work:
> 
> 
> <form  method="post"  
> action="tl3.fwx?todo=editparagraph¶=FHE2V0O81&tl=Y95CC1A21&center="  
> onsubmit='return subm_form(this)'>
> 
> <script>
> function subm_form( frm ) {
> frm.action += tl.getBand(0).band.getCenterVisibleDate.value;
> return true;
> }
> </script>
> 
> Am I messing up the syntax here?
> 
> 
> Thanks 
> Jeff Roehl

-- 
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en.

Reply via email to