document

Why isn't this working?
I'm passing a value in from a hidden field, which would be
document.linkk.lockedAppt.value.

The alert "Going through" shows ups

However the alert message test and test2 never show up.
function getLockedAppt()
      {      
            alert('going through!');
      
            var lockVar=document.linkk.lockedAppt.value;
            alert(lockVar);
            if (lockVar=="false")
            {
                  alert('test');      
            }
            else
            {
                  alert('test2');
            }      
      }
djb80Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rob_lorentzCommented:
java script is case sensitive.make sure the if (lockVar=="" statement matches the first alert. Including spaces. you might want to add a trim setting lockVar.
Ike23Commented:
Are you sure the actual value of the form field is "false"?  If you are checking to see if it is blank then try this:

if (lockVar=="")

Or it could be that you have alert(lockVar); before the if statement and if it is false that might be stopping the function from moving into the if...

Try commenting out the alert(lockVar); before the if statement and see what happens.

Cheers!
rob_lorentzCommented:
the javaScript must be defined after the form. example

<form action="this.html" method="post" name="testForm">
      <input type="text" value="false" name="linkk" id="linkk">
</form>
<script language="JavaScript">
   alert('going through!');
      var lockVar=document.testForm.linkk.value;
          alert(lockVar);
          if (lockVar=="false")
          {
               alert('test');    
          }
          else
          {
               alert('test2');
          }    
 
</script>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.