teoyh
Member
I have 2 dropdowns in my form. The database for the spare parts is found in SAP.
Car Model : (First dropdown)
Spare Parts : (2nd dropdown)
When user select car model, it will then go an pull the spare parts from SAP
In the first dropdown , i have added a javascript event change, purpose is to return the spare parts from SAP base on the model user select.
carmodel = Fabrik.getBlock('form_436').formElements.get('car_info_model').getValue();
var url='index.php?option=com_fabrik&format=raw&task=plugin.userAjax';
new Request({url:url,
data:{method:'GetComponents',
'carmodel':carmodel},
onComplete:function(r){
if(r!==''){
results = r.split(",");
var select = document.getElementById("car_info_component");
select.empty();
for(var i = 0; i < results.length; i++) {
var opt = results;
if(opt!==''){
var el = document.createElement("option");
el.textContent = opt;
el.value = opt;
select.appendChild(el);
}
}
The above work fine is i dont set the 2nd dropdown to enhanced dropdown. But i need to when the list of spare parts get very long.
When i turn on the enhanced dropdown, the list of spare will no long appear inside the enhanced dropdown.
I suspect the javascript for adding the spare part is not correct for the enhanced dropdown
Can someone help me to correct my javascript for the part to add option to the enhanced dropdown.
Thank you in advance
Car Model : (First dropdown)
Spare Parts : (2nd dropdown)
When user select car model, it will then go an pull the spare parts from SAP
In the first dropdown , i have added a javascript event change, purpose is to return the spare parts from SAP base on the model user select.
carmodel = Fabrik.getBlock('form_436').formElements.get('car_info_model').getValue();
var url='index.php?option=com_fabrik&format=raw&task=plugin.userAjax';
new Request({url:url,
data:{method:'GetComponents',
'carmodel':carmodel},
onComplete:function(r){
if(r!==''){
results = r.split(",");
var select = document.getElementById("car_info_component");
select.empty();
for(var i = 0; i < results.length; i++) {
var opt = results;
if(opt!==''){
var el = document.createElement("option");
el.textContent = opt;
el.value = opt;
select.appendChild(el);
}
}
The above work fine is i dont set the 2nd dropdown to enhanced dropdown. But i need to when the list of spare parts get very long.
When i turn on the enhanced dropdown, the list of spare will no long appear inside the enhanced dropdown.
I suspect the javascript for adding the spare part is not correct for the enhanced dropdown
Can someone help me to correct my javascript for the part to add option to the enhanced dropdown.
Thank you in advance