View Single Post
Old 12-03-2004, 06:23 PM   #2 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 209
falsepride is on a distinguished road
okay ive been going over my script again and again, and i got the erros out, it works with no errors its not just working how i want it to. i want it to re-enable the submit button if 2 feilds in the form are empty, but its re-enabling it if only the author value isnt empty.
Heres all of my javascript dealing with the form. the function load it excuted onload.
Code:
function load() {
  if(document.forms["pollform"]) {
    document.forms["pollform"].votebutton.disabled = true;
  }
  if(document.forms["commentform"]) {
    document.forms["commentform"].postbutton.disabled = true;
    tick();
  }
}
function tick() {
  calcCharLeft();
  setTimeout("tick()", 300);
}
function calcCharLeft() {
  maxLength = 500;
  if (document.forms["commentform"].body.value.length > maxLength) {
	document.forms["commentform"].body.value = document.forms["commentform"].body.value.substring(0,maxLength);
	charleft = 0;
	clipped = true;
  } else {
	charleft = maxLength - document.forms["commentform"].body.value.length;
  }
  document.forms["commentform"].msgCL.value = charleft;
  if((document.forms["commentform"].author.value.length !== 0) && (document.forms["commentform"].body.length !== 0)) {
    document.forms["commentform"].postbutton.disabled = false;
  } else {
    document.forms["commentform"].postbutton.disabled = true;
  }
  return false;
}
please help soon, until this is fixed i can't finish setting up the rest of my site
falsepride is offline   Reply With Quote