SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot trekmp's Avatar
    Join Date
    Dec 2005
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Two fields one button

    I have two textboxes and one search button on my form.

    What I want to be able to do is if I have text in one field and then go to the other one and start typing more text, to clear text out of the other one and visa versa.

    I want to be able to have two search fields but only one search button.

    Quite new to .NET so would appreciate any help
    Why do we exist? What is our purpose?
    >H2O Developments
    >USS Endeavour
    >Hosted@Servage

  2. #2
    SitePoint Addict darkwater23's Avatar
    Join Date
    Nov 2005
    Location
    Omaha, NE
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this is more of a Javascript question than a .Net question (but, I'm new to .Net as well). You could use the onChange or onKeyDown events on the 2nd input box to set the 1st input box's .value = ''

    Code:
    <input name="field2" id="field2" type="text" onKeyDown="document.getElementById('field1').value = '';">
    It would probably be better to make a function out of this action so its easier to read and a bit more reusable.

    Is that what you are looking for?
    Last edited by darkwater23; Aug 13, 2007 at 07:26. Reason: clarity


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •