javascript: disabeling form fields

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Unregistered

    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

  • Lee

    #2
    Re: javascript: disabeling form fields

    Unregistered said:[color=blue]
    >
    >
    >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.[/color]

    <form>
    <input name="alpha" onchange="this. form.beta.disab led=this.value. length>0">
    <input name="beta" onchange="this. form.alpha.disa bled=this.value .length>0">
    </form>

    Comment

    • kaeli

      #3
      Re: javascript: disabeling form fields

      In article <bui2s3029e4@dr n.newsguy.com>, REM0VElbspamtra p@cox.net
      enlightened us with...[color=blue]
      >
      > <form>
      > <input name="alpha" onchange="this. form.beta.disab led=this.value. length>0">
      > <input name="beta" onchange="this. form.alpha.disa bled=this.value .length>0">
      > </form>
      >
      >[/color]

      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.



      Comment

      • Unregistered

        #4
        Re: javascript: disabeling form fields


        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.f orm.beta.value= ''">
        <input name="beta" onclick="this.f orm.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

        Comment

        Working...