Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zapatek Date Selector

Status
Not open for further replies.

TamedTech

IS-IT--Management
May 3, 2005
998
GB
Hello Guys,

I'm using the little date selector widget from zapatek and it seems to be working just fine, however I'm looking to edit the function that is run when a date is selected.

Code:
    <script type="text/javascript">//<![CDATA[
      function flatCalendarCallback(cal) {
        if (cal.dateClicked) {
          var url = "[URL unfurl="true"]http://www.mydomain.com/"[/URL] + cal.date.print("%Y/%m/%d/");
          alert("Jumping to: “" + url + "” (not really).");
          // uncomment the following line to actually jump:
          // window.location = url;
        }
      };
    //]]></script>

That is the current function, which prints a pop-up stating that its going to jump to a URL containing the date. However I want the date to populate a text field in a form when the date is selected. The date needs to be enetered into the form field in the same format as the URL example above, like %Y/%m/%d/.

Can anyone help me with this?

Thanks guys,

Rob
 
Hey Adam,

Thanks for getting back to me mate. I would agree with you thet the print statement returns the date as a string, however, I have no JS knowledge what so ever and Dont really know where to begin with placing that value into the form field?

Any change of an example?

Thanks mate,

Rob
 
No Worries!

Figured it out myself! woo!

Code:
    <script type="text/javascript">//<![CDATA[
      function flatCalendarCallback(cal) {
        if (cal.dateClicked) {
          form=document.FormName;
		  form.TextFieldName.value = cal.date.print("%Y/%m/%d");
        }
      };
    //]]></script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top