Jump to content

length is null or not an object error in IE8


jebaraj

Recommended Posts

Hi,

    I have added an validation script for Pizza menu. Validation working fine in all browsers except IE.

When I working in IE8 it throws an error "length is null or not an object error in IE8".

Please help me. See Java script code below:

<script>
function UnCheckRadios(radioButtonGroupName)
{

var formName = "frmOrder";
var form = document.forms[formName];
alert(form);
var noOfRadioButtons=form[radioButtonGroupName].length;
for(var x=0;x<noOfRadioButtons;x++)
{
	chk=form[radioButtonGroupName][x].checked=false;
}
}
</script>

 

PHP code:

<input type="radio" id="<?=$subitem['subgroup_id'];?>_comboleft" name="<?=$subitem['subgroup_id'];?>_comboleft"  value="<?=$subitem['id'];?>:Left Side" onclick="UnCheckRadios('<?=$subitem["subgroup_id"];?>_combowhole');">

 

 

 

[attachment deleted by admin]

In and of itself, the function works fine in IE8.  Clicking on something that calls your function clears it just fine. Here is test code I used:

 


<script type='text/javascript'>
function UnCheckRadios(radioButtonGroupName)
{

var formName = "frmOrder";
var form = document.forms[formName];

var noOfRadioButtons=form[radioButtonGroupName].length;
for(var x=0;x<noOfRadioButtons;x++)
{
	chk=form[radioButtonGroupName][x].checked=false;
}
}
</script>

<form name='frmOrder'>
  <input type="radio" name="colors" id="red" />Red<br />
  <input type="radio" name="colors" id="blue" />Blue<br />
  <input type="radio" name="colors" id="green" />Green<br />
</form>

<button type="button" onclick="UnCheckRadios('colors')">uncheck</button>

 

Look at the output of your form radio buttons, make sure that your php script is outputting what it is supposed to be outputting (the right radio button names).  Also make sure your form is named "frmOrder". 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.