You need to sign in to do that
Don't have an account?
Simrin
Javascript not called if value is null
<script type="text/javascript"> function call(id1,id2,id3){ callAction(document.getElementById(id1).value,document.getElementById(id2).value,document.getElementById(id3).value); } </script> <apex:selectList size="1" value="{!wValue}" id="check1" onchange="call('{!$Component.check1}','{!$Component.check2','{!$Component.check3}';"> <apex:selectOption itemValue="Select"/> <apex:selectOptions value="{!lOptions}" /> </apex:selectList>sometimes my value is null and the javascript is not called
You mean the compenent deosn't exist sometime ? or Valus of the component will be null some time ?
function call(id1,id2,id3){
var c1 ='';
var c2 ='';
var c3 ='';
if(document.getElementById(id1) != null)
c1 =document.getElementById(id1).value;
if(document.getElementById(id2) != null)
c2 =document.getElementById(id1).value;
if(document.getElementById(id3) != null)
c3 =document.getElementById(id1).value;
callAction(document.getElementById(id1).value,document.getElementById(id2).value,document.getElementById(id3).value);
}
Regards,
BD
All Answers
They are id of selectList.
If any of the the value out of Check1, Check2, Check3 are null, then my javascript is not called and i cannot progress
You mean the compenent deosn't exist sometime ? or Valus of the component will be null some time ?
function call(id1,id2,id3){
var c1 ='';
var c2 ='';
var c3 ='';
if(document.getElementById(id1) != null)
c1 =document.getElementById(id1).value;
if(document.getElementById(id2) != null)
c2 =document.getElementById(id1).value;
if(document.getElementById(id3) != null)
c3 =document.getElementById(id1).value;
callAction(document.getElementById(id1).value,document.getElementById(id2).value,document.getElementById(id3).value);
}
Regards,
BD