function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BrabasBrabas 

dynamic Component and javaScript. problem

 

 

Greetings, I have a problem with Dynamic Components, I display a datepicker I have a function in JavaScript, the code works correctly tagged apex, the problem is to want to call the same function from a Dynamic Component.

 

function initialiseCalendar(obj, eleId) 
{
 var element=document.getElementById(eleId);
 var params='close=true' ;
 if (null!=element)
 {
  if (element.value.length>0)
  {
   // date is formatted dd/mm/yyyy - pull out the month and year
   var day=element.value.substr(0,2);
   var month=element.value.substr(3,2);
   var year=element.value.substr(6,4);
   params+=',day='+day;
   params+=',month='+month;
   params+=',year='+year;
  }
 }
 fnInitCalendar(obj, eleId, params);
}

 

 

 <apex:inputText id="dEPolicy" size="10" maxlength="10" value="{!dEPolicy}" onmouseover="initialiseCalendar(this, '{!$Component.dEPolicy}')"/> 

 

 

Component.Apex.inputText it_dSPolicy=new Component.Apex.inputText ();
                               it_dSPolicy.label='Date Start:';
                               it_dSPolicy.value=o.dSPolicy__c;
                               it_dSPolicy.expressions.value='{!dSPolicy}';
                               it_dSPolicy.id='dSPolicy';                             
                               it_dSPolicy.onmouseover='initialiseCalendar(this,"{!$Component.dSPolicy}")';

 

Greetings, I have a problem with Dynamic Components, I display a datepicker I have a function in JavaScript, the code works correctly tagged apex, the problem is to want to call the same function from a Dynamic Component.

Executing code from a controller, but the datepicker is displayed when clicking on nothing happens. The problem is this call, do not check errors here but not executed properly.

 

 it_dSPolicy.onmouseover='initialiseCalendar(this,"{!$Component.dSPolicy}")';

otherwise mark this Error.

 it_dSPolicy.onmouseover='initialiseCalendar(this,'{!$Component.dSPolicy}')';

 

 

thanks.