470,849 Members | 1,350 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

javascript: disabeling form fields


Hi,

First, excuse me for my bad English, I'm Dutch.... :-)

I know there's a lot of information about disabeling form fields, but
cannot find the script I need:

I'm looking for a script where, if you fill in the first of two fields
the second field is getting disabled and vice versa. So you can neve
have TWO fields filled in.

I know that this can be done with JavaScript, but I don't know ho
exactly.

Could anybody help me with this please?

Thanks in regard,

Daa

Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message34791.htm

Jul 20 '05 #1
3 1095
Lee
Unregistered said:


Hi,

First, excuse me for my bad English, I'm Dutch.... :-)

I know there's a lot of information about disabeling form fields, but I
cannot find the script I need:

I'm looking for a script where, if you fill in the first of two fields,
the second field is getting disabled and vice versa. So you can never
have TWO fields filled in.

I know that this can be done with JavaScript, but I don't know how
exactly.


<form>
<input name="alpha" onchange="this.form.beta.disabled=this.value.lengt h>0">
<input name="beta" onchange="this.form.alpha.disabled=this.value.leng th>0">
</form>

Jul 20 '05 #2
In article <bu*********@drn.newsguy.com>, RE**************@cox.net
enlightened us with...

<form>
<input name="alpha" onchange="this.form.beta.disabled=this.value.lengt h>0">
<input name="beta" onchange="this.form.alpha.disabled=this.value.leng th>0">
</form>


Note that disabled fields will NOT submit.
I found that out the hard way. :)

--
--
~kaeli~
A little rudeness and disrespect can elevate a meaningless
interaction to a battle of wills and add drama to an
otherwise dull day.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3

i did'nt ask te question that I really needed to know: It's no us
ofcourse, to disable the opposite field of the one that's filled in.
meant the following code (that I found out myself, but thanks anywa
;-))

<form>
<input name="alpha" onclick="this.form.beta.value=''">
<input name="beta" onclick="this.form.alpha.value=''">
</form>

Supersimple, but very usefull to me, because otherwise my MySQ
database would search for BOTH inputs, wich does'nt result in th
records I need.

excuse me for my bad English, again.

Greets,

Daa

Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message34791.htm

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Gowhera Hussain | last post: by
4 posts views Thread by Ken Nipper | last post: by
7 posts views Thread by Paulo Roberto | last post: by
3 posts views Thread by anthonybrough | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.