This page shows integration of Jaxcent with a Date Picker (Calendar) from Zapatec. The date picker is shown to the right. Select any date, and the selected date will be sent to the server. In this sample, the server simply echoes the selection by posing a message dialog box.


How To

Just follow the vendor's instructions for embedding the calendar, in the configuration you want. Then replace the url by a call to JaxcentServerRequest.

This does not require much JavaScript knowledge, but you do have to edit a JavaScript function to replace the target link. In this sample, the existing code

     var url = "http://www.mydomain.com/" + cal.date.print("%Y/%m/%d/");
     alert("Jumping to: “" + url + "” (not really).");
     // uncomment the following line to actually jump:
     // window.location = url;
in the JavaScript function flatCalendarCallback, has been replaced with
     JaxcentServerRequest( "Date: " + cal.date.print( "%Y/%m/%d/" ));

On the Jaxcent side, override the onJavaScriptRequest of the JaxcentPage class, to retrieve the string passed in from the JavaScript side. You can provide more than one arguments in the javascript call. Additional arguments will be provided as a String-array on the Java side. The Java side can then take the appropriate action based on the string that came in.

The Java code that handles this page is provided below:


package sample;

public class MenuSample extends jaxcent.JaxcentPage {

    protected void onJavaScriptRequest(java.lang.String cmd, java.lang.String[] args)
    {
        showMessageDialog( "Server received cmd: " + cmd );
    }
}