[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Need help with a form.

Assuming that billsrch is the name of your form (having elements of 'bnumber' and 'bkeyword') you could try this:

if (document.billsrch.bnumber.value != "" &&
    document.billsrch.bkeyword.value != "")  {
          alert('You can only fill out one of the fields!')

Andy Augustine

From: 	Mike Darrin[SMTP:msd111@psu.edu]
Sent: 	Wednesday, February 21, 1996 12:03 PM
To: 	javascript@obscure.org
Subject: 	Need help with a form.

I am trying to integrate a small javascript into a Bill Search form.  The 
form allows users to search the Bills by Bill Number or by Keyword.  I 
would like to have a script that pops up an alert box if a user enters 
something in BOTH the Bill Number box and the Keyword box.  The alert box 
will say "Search by one method or the other", or something like that.

I've spent several hours wading around in the Netscape JavaScript 
Authoring Guide, enough to get pretty confused about forms, the options 
array, etc.  It seems that I want something that says (see below for the 
  if document.billsrch.bnumber = "anything"  &&   
  document.billsrch.bnumber= "anything"  
	alert ("you can't do that!")

But I don't know exactly how to form the statement.

I apologize for asking such an apparently simple question, but if someone 
can help me out here it would be greatly appreciated.  To be honest, I 
find it hard to justify (to myself) spending many more (taxpayer-paid) 
hours playing with this thing if someone out there can help me.

Thank you, 
Mike Darrin

Michael S. Darrin
Legislative Data Processing Center
Pennsylvania General Assembly


<<File: ATT00000.html>>