Jump to content

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". 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.