Quantcast
Channel: SCN : Document List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 189

Trigger Server roundtrip for date field

$
0
0

The date picker for a date input field is made using javascript on client side. To trigger a round trip , you have to write some code on client side.

Code mentioned below has to be written on .htm page of the view.

 

<script>

thtmlbCalendar.pick = function(e) {

     var o = (e.target) ? e.target : e.srcElement;

     var sId = this.lastInstance;

     var oInput = thtmlbGetElement(sId);

     if (o.id === "currentDate") {

       e.cancelBubble=true;

       return;

     }

     var currentDateValue = document.getElementById('currentDate').value;

     while (o.tagName != "TD") {

       o = o.parentNode;

       if (o == null){

         return;

       }

     }

     var sDay = o.id;

     if (sDay==null || sDay==""){

       return;

     }

     if (sDay) {

       var aDate = sDay.split("-");

       var arrValue = [];

       arrValue[0]=parseInt(aDate[2]);

       arrValue[1]=parseInt(aDate[1]);

       arrValue[2]=parseInt(aDate[0], 10);

       var newValue = this.getFormattedDate(arrValue[0], arrValue[1], arrValue[2]);

       thtmlbSetInputFieldAttribute(oInput, 'encodedValue', newValue);

       e.cancelBubble=true;

       oInput.focus();

       this.hide();

       var element_event = sId + ":submitonenter";

       htmlbSL(this,2,element_event,'0');

     }

   };

</script>

 

You don't need to change anything in the above code.

 

If you want to avoid writing the code on .htm page then you can also write the above code in a js file and upload in your component through tcode se80->MIME repository->SAP->BC->BSP->SAP->Your component name->right click for Import MIME Objects->select your JS file.

After the js file upload is complete, include js file in your htm page.

 

<script type="text/javascript" src="/sap/bc/bsp/sap/your_compoent_name/your_js_name.js"></script>

 

Thanks and Regards,

Ritu


Viewing all articles
Browse latest Browse all 189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>