Hi,
When try to validate the textbox generated by innerHTML, it returns "Undefined" for the textbox. Therefore, i cannot validate it.
Thanks
<html>
<head>
<script type="text/javascript">
function validateForm () {
if (document.form1.textContactname.value.length == 0) {
alert ("ERROR");
return false;
}
return true;
}
function createInvoice () {
document.getElementById("hiddenPayment").innerHTML = '<br /><table border="0" cellspacing="0" cellpadding="0"><tr><td width="187">Contact name</td><td><input type="text" name="textContactname" size="50" maxlength="80" /></td></tr><tr><td>Employer name</td><td><input type="text" name="textEmployername" size="70" maxlength="100" /></td></tr><tr><td>Employer address</td><td><input type="text" name="textContactname" size="70" maxlength="100" /></td></tr></table> <br />';
}
</script>
<head>
<body>
<form name="form1" action="save.php" method="POST" onsubmit="return validateForm()">
<input type="radio" name="radioPayment" value="Invoice" onclick="createInvoice()" />
<div id="hiddenPayment"> </div>
<input type="submit" name="submitButton" value="Submit">
</form>
</body>
</head>