473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Allowing only one field to contain a value

Here's what needs to be done.

I have a form with email1, email2, email3, email4, and email5.

I need a way to have an alert come up when more than one email field
contains a value. The user can only enter only one email in one of the
input fields.

Thanks.

Oct 24 '05 #1
5 1204

yj****@gmail.com wrote:
Here's what needs to be done.

I have a form with email1, email2, email3, email4, and email5.

I need a way to have an alert come up when more than one email field
contains a value. The user can only enter only one email in one of the
input fields.

Thanks.


If the user can only enter one email in the form, then is it even
necessary to have email2 - 5 ?

Oct 24 '05 #2
Well email 2 looks into a different field so it's needed since emails
can be stored in different fields.

Any ideas on how to do a check on submit and have an alert?

Oct 24 '05 #3
wrote on 24 okt 2005 in comp.lang.javascript:
Well email 2 looks into a different field so it's needed since emails
can be stored in different fields.

Any ideas on how to do a check on submit and have an alert?


Make one form-input-field and a select or radio-button choice of where to
put it in the database(?).

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #4
JRS: In article <11*********************@o13g2000cwo.googlegroups. com>,
dated Mon, 24 Oct 2005 09:09:05, seen in news:comp.lang.javascript,
yj****@gmail.com posted :
Here's what needs to be done.

I have a form with email1, email2, email3, email4, and email5.

I need a way to have an alert come up when more than one email field
contains a value. The user can only enter only one email in one of the
input fields.


Let X.email1 be a well-formed way of addressing email1.

Then
with (X) Y = !!email1.value + !!email2.value + ... !!email5.value
seems to count the number of non-empty boxes.
if (Y>1) alert("whoa!") // if at most one must be non-empty.
if (Y!=1) alert("whoa!") // if exactly one must be non-empty.

You can determine the value of the non-empty field by concatenating them
all; but to determine which it is you'll probably have to seek it.

Overall, it might be better to loop through seeking the first and then
continue (or modify the above) to check for any more.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Oct 24 '05 #5
Thanks. that's a perfect idea.

Oct 25 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: WindAndWaves | last post by:
Hi Gurus In my quest in putting my first javascript together, I am now trying to conquer something that seems trivial, but has taken me hours. I would like to format a field in a form once the...
1
by: Don Leverton | last post by:
Hi Folks, I have been given a CD with approx 130 .xls files (bean-counters!) that I would like to import and merge to ONE table (tblTradeshow). The XL files are *similarly*, but not...
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
6
by: Modest Marsupial | last post by:
What is the DAO method of allowing a recordset to have null values? Thanks, marie
3
by: tshad | last post by:
I have a RegularExpressionValidator that doesn't seem to work correctly if you don't enter anything. In the following, it works correctly if you have at least 1 character. If you just enter...
7
by: Tizzah | last post by:
What is wrong with that? regex = /^(http|https):\/\/+({1}+)*\.{2,5}(({1,5})?\/.*)?$/ if(field.hpage.value != regex.test(field.hpage.value)){ alert("Bad Homepage") field.hpage.focus()...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
7
by: p.lavarre | last post by:
How do I vary the byte offset of a field of a ctypes.Structure? How do I "use the dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by...
5
by: bkberg05 | last post by:
Hi - I have a combo box field on a form. The field is required (can't be left blank). Occassionally a user will come to the field and the combo box will not contain the desired record. So I added...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.