![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
hi all, my dropdownlist 'cboUnitTypes' is populating on the base of another dropdownlist1, i have to apply a check on 'cboUnitTypes' like if(cboUnitTypes[cboUnitTypes.selectedindex].value==0)return false; now problem is; i face an error describing 'cbounittypes is either null or not an object' when i see view source, firefox and IE showing different source code.firefox is showing right. but IE not. what's reason?? ----- viewsource using firefox select name="cboUnitTypes" onchange="javascript:return ConfirmDeleteImage();__doPostBack('cboUnitTypes',' ')" language="javascript" id="cboUnitTypes" class="TextFieldNormalForProperty" |
|
<option selected="selected" value="0"></option <option value="396">34</option <option value="405">nothing</option <option value="412">test</option /select ----- viewsource using IE select name="cboUnitTypes" onchange="javascript:return ConfirmDeleteImage();__doPostBack('cboUnitTypes',' ')" language="javascript" id="cboUnitTypes" class="TextFieldNormalForProperty" style="width:200px;" /select |
#3
| |||
| |||
|
|
As for the error you're seeing. If you post the Javascript that's generating this error, we'll have a better chance of helping you ---- |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
one more thing, dropdownlist cbounittype is populated from db but depending upon another dropdownlist's selected index changed. |
#6
| |||
| |||
|
|
i face an error describing 'cbounittypes is either null or not an object' when i see view source, firefox and IE showing different source code.firefox is showing right. but IE not. what's reason?? ----- viewsource using firefox select name="cboUnitTypes" onchange="javascript:return ConfirmDeleteImage();__doPostBack('cboUnitTypes',' ')" language="javascript" id="cboUnitTypes" class="TextFieldNormalForProperty" |
|
----- viewsource using IE select name="cboUnitTypes" onchange="javascript:return ConfirmDeleteImage();__doPostBack('cboUnitTypes',' ')" language="javascript" id="cboUnitTypes" class="TextFieldNormalForProperty" style="width:200px;" |
#7
| |||
| |||
|
|
thx. error message is no more raising. As for the error you're seeing. If you post the Javascript that's generating this error, we'll have a better chance of helping you ---- but i can't my dropdownlist values in IE. here is complete info. select name="cboUnitTypes" onchange="javascript:return ConfirmDeleteImage();__doPostBack('cboUnitTypes',' ')" language="javascript" id="cboUnitTypes" class="TextFieldNormalForProperty" style="width:200px;" /select I am working for IE, not for Firefox. |
#8
| |||
| |||
|
|
CreativeMind a écrit : thx. error message is no more raising. As for the error you're seeing. If you post the Javascript that's generating this error, we'll have a better chance of helping you ---- but i can't my dropdownlist values in IE. here is complete info. select name="cboUnitTypes" onchange="javascript:return ConfirmDeleteImage();__doPostBack('cboUnitTypes',' ')" language="javascript" id="cboUnitTypes" class="TextFieldNormalForProperty" style="width:200px;" /select I am working for IE, not for Firefox. ... ????? ... Poor IE ! and poor Opera ! script type='text/javascript' function ConfirmDeleteImage() { var result; var cbo = document.all? document.all['cboUnitTypes'] : document.getElementById? document.getElementById('cboUnitTypes') : document.myForm.cboUnitTypes; if (cbo.options.length <= 0) return false; if (document.all) { var hide = document.all['lblHiddenUnitType']; if( hide.value != null && hide.value > 0 ) { result= confirm('Existing Image(s) will be replaced with the '+ 'new one(s).\nDo you want to continue?'); if(result == false) { cbo.onchange = null; cbo.value = hide.value; // that works with IE ? // cbo.selectedIndex = hide.value; cbo.onchange = ConfirmDeleteImage; } else { cbo.onchange = null; hide.value = cbo.value; cbo.onchange = ConfirmDeleteImage; __doPostBack('cboUnitTypes',''); // doPostBack will no more // be in the onchange } return result; } else if (hide.value != null) { alert('what do you want to do ?'); } } } /script version #2 : script type='text/javascript' function ConfirmDeleteImage() { var cbo = document.all? document.all['cboUnitTypes'] : document.getElementById? document.getElementById('cboUnitTypes') : document.myForm.cboUnitTypes; if (cbo.options.length <= 0) return false; if (document.all) { var hide = document.all['lblHiddenUnitType']; if( hide.value != null) { hide.value = cbo.value; if( confirm('Existing Image(s) will be replaced with the '+ 'new one(s).\nDo you want to continue?') ) { cbo.onchange = null; cbo.onchange = ConfirmDeleteImage; __doPostBack('cboUnitTypes',''); // doPostBack will no more return true; // be in the onchange } cbo.onchange = null; cbo.selectedIndex = hide.value; cbo.onchange = ConfirmDeleteImage; return false; } } } /script -- sm |
#9
| |||
| |||
|
|
thanx a lot of you SAM, that solved my problem. could you please tell about why doesn't IE's viewsource show values of dropdownlist unlike FF. |
#10
| |||||||
| |||||||
|
|
script type='text/javascript' function $(id) // multi browser getter of an element |
|
{ return typeof id != 'string'? id : document.getElementById? document.getElementById(id) : document.all? document.all[id] : document.forms[0].elements[id]; // suppose an alone form } |
|
function ConfirmDeleteImage() // would have to work with any browser { var cbo = $('cboUnitTypes'); if (cbo.options.length <= 0) |
|
{ alert('I do not understand why the function did fire'); return false; } if (cbo.selectedIndex == 0) |
|
{ alert('Choice another item in the list'); |
![]() |
| Thread Tools | |
| Display Modes | |
| |