Link to home
Start Free TrialLog in
Avatar of Forrest_Gump
Forrest_Gump

asked on

document.form.ckbox is null or not an object

how can i fix this?
please help...i have 2 hours to fix it and i have no idea how:(
<script language="JavaScript">
function get_check_value()
{
      var c_value = "";
 
      for (var i=0; i < document.form.ckbox.length; i++)
      {
            if (document.form.ckbox[i].checked)
            {
                  c_value = c_value + document.form.ckbox[i].value + "\n";
            }
      }
 
      if ( c_value != "" )
      {
            getcustomer ( c_value );
      }
 
}
 
function getcustomer ( customer )
{
      // do something with the customer
      // then call return
}
</script>
 
 
<form action="" method="">
...
response.write "<p><input type=""checkbox"" name=""menu"" value='" & rstemp1("id") & "' >" & rstemp1("subcat") & "</p>"
...
</form>
 
<A href="#" onclick="get_check_value();">find values</A>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
do you generate form controls first clearly? lot of syntax errors on your form code
What syntax errors???

Missing values for method and action could just be because it is an example

Avatar of Forrest_Gump
Forrest_Gump

ASKER

document.form.ingrid is null or not an object:(
<form>
<%
...
response.write "<input type=""checkbox"" name=""ingrid"" value='" & rstemp1("id") & "' >" & rstemp1("subcat") & "<br>"
...
%>
 
<A href="#" onClick="showingr(get_check_value()); return false">find values</A>
</form>
 
 
 
.......
 
 
function get_check_value() {
  var c_value = "";
  for (var i=0; i < document.form.ingrid.length; i++) {
    if (document.form.ingrid[i].checked) {
      c_value = c_value + document.form.ingrid[i].value + "\n";
    }
  }
  return c_value; // may be empty
}
 
function showingr(customers) {
  if (customers=="") return; // leave the function
 
{ 
xmlHttpSel2=GetXmlHttpObject();
if (xmlHttpSel2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getcustomer.asp";
url=url+"?ingr="+customers;
url=url+"&sid="+Math.random();
xmlHttpSel2.onreadystatechange=ingrChanged;
xmlHttpSel2.open("GET",url,true);
xmlHttpSel2.send(null);
}
 
function ingrChanged() 
{ 
if (xmlHttpSel2.readyState==4)
{ 
document.getElementById("txtHint").value=xmlHttpSel2.responseText;
}
}
 
 
}

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
http://ilmc.brinkster.net/cpp/web/getcustomer.asp
that is not doing anything:(
i got no error but i am clicking on the
      <p><input type="CHECKBOX" name="ingrid" value="3"> ...and The Other</p>
and that is not going anywhere...
dear mplungjan,
you soved the original question problem so i am closing this question and thakyou for that.
but the origianl problem was not solved so please help me here:
https://www.experts-exchange.com/questions/23513718/Ajax-problem.html