cwolgamott
Programmer
Hello. I am creating some ASP pages to add, change and delete. In my change pages, I need to check to see if they have entered a value in a specific text box. Then, I need to check to see if they have changed the value that was already in the text box when it was loaded up. If it was changed, I need to pop up a message that states that the number already exists in the database and set the focus to the text box. I have tried to create a function to do this. It is as follows:
function checktheboxes() {
if (document.form1.regulator.value == ""
{
alert("Please fill out the regulator field"
document.form1.regulator.focus();
return (false);
}
if((document.form1.regulator.value) != (rsRegDetails.Fields.Items("Regulator".Value)){
if ((document.form1.regulator.value) == (rs.Fields.Items("Regulator".Value))
{
alert("This regulator number already exists in the database."
document.form1.regulator.focus();
return (false);
}
}
return true;
}
Then I put it in the form tag:
<form name="form1" method="post" action="admregend.asp" onSubmit="return checktheboxes()">
However, this does not work. It does not check like it should. I would greatly appreciate any suggestions. Thanks.
function checktheboxes() {
if (document.form1.regulator.value == ""
{
alert("Please fill out the regulator field"
document.form1.regulator.focus();
return (false);
}
if((document.form1.regulator.value) != (rsRegDetails.Fields.Items("Regulator".Value)){
if ((document.form1.regulator.value) == (rs.Fields.Items("Regulator".Value))
{
alert("This regulator number already exists in the database."
document.form1.regulator.focus();
return (false);
}
}
return true;
}
Then I put it in the form tag:
<form name="form1" method="post" action="admregend.asp" onSubmit="return checktheboxes()">
However, this does not work. It does not check like it should. I would greatly appreciate any suggestions. Thanks.