Javascript Validation

I need to insert another form field named "pAccessLevel" and the user can only enter the values '1' or '0'. What is the javascript for that?

My current code is as follows:

function validForm()
      var Frm, pass;              
         Frm = document.AdminListUser;
      pass = true;

      if (IsEmptyField(Frm.pUserName.value) )
            alert("Please enter User ID.");
            pass = false;
      else if (IsEmptyField(Frm.pName.value) )
            alert("Please enter Name.");
            pass = false;

etc. etc....
Who is Participating?
RoonaanConnect With a Mentor Commented:
<select name="pAccesslevel">
 <option value="0">0</option>
 <option value="1">1</option>


zamorinAuthor Commented:
O.K, that was silly.

Let me try it, I'll get back to you soon.
zamorinAuthor Commented:
works like a dream!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.