R
Randell D.
Whats wrong with my sample script below? All I want to do is confirm that
my form data is in my environment (basically, I'm writing a script that will
check that some form fields have a value, and others don't - The
functionality of this will be used in my other script but I want to make
sure I know whats happening first as opposed to bastardizing someone else's
work).
I have worked some of the code out - I figured the what should be working
below would be easy enough but again, I'm coming up with a surprise... I'm
not getting any errors... "firstFunction()" manages to get the first
document.write to work, but the rest of it fails (ie no values, no errors).
Can someone help?
Much appreciated,
randelld
ps here's my code...
<script language="JavaScript">
function firstFunction()
{
document.write("<br>document.patient.length = " + document.patient.length);
document.write("<br>document.patient.weeks.value = " +
document.patient.weeks.value);
document.write("<br>document.patient.elements[1].value = " +
document.patient.elements[1].value);
return;
}
</script>
<form name="patient">
<p></p><hr>
Insanity checklist. Enter number of weeks: <input name="weeks" type="text">
<p></p>
Clothing preferences:
<select name="diet">
<option value="napolean">Dr Napolean</option>
<option value="darcy">Dr Darcy</option>
<option value="strangelove">Dr Strangelove</option>
</select>
<br>
<input type="submit" onclick="firstFunction(); return">
<hr><a href="./e.html">again</a><hr>
</form>
my form data is in my environment (basically, I'm writing a script that will
check that some form fields have a value, and others don't - The
functionality of this will be used in my other script but I want to make
sure I know whats happening first as opposed to bastardizing someone else's
work).
I have worked some of the code out - I figured the what should be working
below would be easy enough but again, I'm coming up with a surprise... I'm
not getting any errors... "firstFunction()" manages to get the first
document.write to work, but the rest of it fails (ie no values, no errors).
Can someone help?
Much appreciated,
randelld
ps here's my code...
<script language="JavaScript">
function firstFunction()
{
document.write("<br>document.patient.length = " + document.patient.length);
document.write("<br>document.patient.weeks.value = " +
document.patient.weeks.value);
document.write("<br>document.patient.elements[1].value = " +
document.patient.elements[1].value);
return;
}
</script>
<form name="patient">
<p></p><hr>
Insanity checklist. Enter number of weeks: <input name="weeks" type="text">
<p></p>
Clothing preferences:
<select name="diet">
<option value="napolean">Dr Napolean</option>
<option value="darcy">Dr Darcy</option>
<option value="strangelove">Dr Strangelove</option>
</select>
<br>
<input type="submit" onclick="firstFunction(); return">
<hr><a href="./e.html">again</a><hr>
</form>