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
khillan bhardwajkhillan bhardwaj 

setting Attribute to picklist on detail pagelayout

Dear Sir,

 

i have picklist on detail page when someone make inline edit on detail page i want to show warning message "when user try to change the pictlist value" i have did this edit page . by adding event 'onchange' .by  writing javascript  code in home page component:

 

<script>
var originalOnLoad = window.onload;
var pickValue;
var pickChange;
function testTurbine() {
originalOnLoad();
var currURL = document.URL;
if(currURL.indexOf("006") !=-1){
pickChange=document.getElementById('00N900000067ev1');
if(pickChange==null){
pickChange=document.getElementById('00N900000067ev1_ileinner');
pickChange.setAttribute("ondblclick","confirmMessage1();");
}
pickValue=pickChange.value;
pickChange.setAttribute("onchange","confirmMessage();");
}
if(currURL.indexOf("a03") != -1) {
var lookupId = document.getElementById('CF00N90000004Sw0L_lkwgt');
lookupId.setAttribute("href","javascript&colon;openFilterLookup()") ;
}
}

function confirmMessage1(){
pickChange= document.getElementById('00N900000067ev1');
pickChange.setAttribute("onchange","confirmMessage();");
pickValue=pickChange.value;
}
function confirmMessage(){
var v=confirm("Warning: changing field “Estimate at Job or Project” can result in data loss - Are you sure?");
if(v){
pickValue=pickChange.value;
}else{
pickChange.value=pickValue;
}
}

</script>

 

but in case of inline editing id of the picklist is created when i double click on the field. so in this way i am searchin a code either in javascript, or jquery. which bind the event whenever  that element is create .

Or . i need a code which can bind with id as soon as that id created of the  element .