Hi everyone I am trying to utilize javascript to check the length of one of my coldfusion inputs. Here is the code I have come up with to verify and chedk the string. I have very little java knowledge so I'm not sure if this is correct.
<script language="JavaScript">
function CheckMgrID(string) {
var error = "";
if (!(string.length == 6))
{
error = "ManagerID must be characters long.";
}
return error;
}
function CheckForm(insertEmpITDataDetailsAdd) {
var why ="";
why += CheckMgrID(insertEmpITDataDetailsAdd.'ItemID#getIDDetails.ItemID#_DetailID#getIDDetails.ID#'.value);
if (why != "") {
why="Please fill in the following mandatory fields:\n\n\n"+why;
alert(why);
return false;
}
return true
}
</script>
name of the form: insertEmpITDataDetailsAdd
name of the input that is being checked:
'ItemID#getIDDetails.ItemID#_DetailID#getIDDetails.ID#'
I understand if no one can help me out in coldfusion but if someone could at least verify my javascript code and make sure it is okay I would be very grateful. For my form I have the following code:
<cfform name="insertEmpITDataDetailsAdd" action="template.cfm" method="post" onsubmit ="return checkMgrID(this)">
<script language="JavaScript">
function CheckMgrID(string) {
var error = "";
if (!(string.length == 6))
{
error = "ManagerID must be characters long.";
}
return error;
}
function CheckForm(insertEmpITDataDetailsAdd) {
var why ="";
why += CheckMgrID(insertEmpITDataDetailsAdd.'ItemID#getIDDetails.ItemID#_DetailID#getIDDetails.ID#'.value);
if (why != "") {
why="Please fill in the following mandatory fields:\n\n\n"+why;
alert(why);
return false;
}
return true
}
</script>
name of the form: insertEmpITDataDetailsAdd
name of the input that is being checked:
'ItemID#getIDDetails.ItemID#_DetailID#getIDDetails.ID#'
I understand if no one can help me out in coldfusion but if someone could at least verify my javascript code and make sure it is okay I would be very grateful. For my form I have the following code:
<cfform name="insertEmpITDataDetailsAdd" action="template.cfm" method="post" onsubmit ="return checkMgrID(this)">