CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member


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

6 Comments