Results 1 to 9 of 9

Thread: Update input box via link

  1. #1
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Update input box via link

    Down the right hand side of the screen I have a list of names. The main part of the page is a collection of input boxes used to edit the timetable where I work.

    WHat I'd like to be able to do, is by clicking one of the names on the right, edit the content of the current active input box.

    So let's say the current active box is

    "Rod, Jane,"

    On clicking the link 'Freddie' I want it to become

    "Rod, Jane, Freddie"

    I figure I need to do this with a javascript function, but am clueless as to what it'd be. Any ideas?

    Cheers!

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Update input box via link

    You might find a great IDE makes it a lot simpler, download
    http://msdn2.microsoft.com/en-gb/express/default.aspx
    its free after all.

    This is very trivial thou, and if i wasn't at work i'd code up an example, but just try looking for a javascript tutorial that explains onClick.
    throw new ArgumentException (String, String, Exception)

  3. #3
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS

    Re: Update input box via link

    assuming he's writing ASP.NET

  4. #4
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Update input box via link

    Enless they've changed it since beta, its still a kickarse dev env for doing javascript and xslt/xpath.

    Regardless of the server side language (you just go new html document).
    throw new ArgumentException (String, String, Exception)

  5. #5
    Senior Member
    Join Date
    Sep 2006
    Location
    Cheltenham
    Posts
    269
    Thanks
    1
    Thanked
    8 times in 8 posts
    • Rishi's system
      • Motherboard:
      • Asus P5B
      • CPU:
      • Intel E6600 2.4Ghz
      • Memory:
      • Corsair 2GB - PC6400
      • Storage:
      • 1 x 250GB Maxtor 16MB Cache
      • Graphics card(s):
      • None :(
      • PSU:
      • hmmm :/
      • Case:
      • Black - Standard
      • Monitor(s):
      • 19" TFT 8ms
      • Internet:
      • Orange (I think!)

    Re: Update input box via link

    Aye, JavaScript innit

    At work too, type enough code as it is, have a look on google for "javascript onclick" and maybe try adding textbox to that. Its quite simple code. Basically copying one value to another.

    If I get time later I'll whip up some code
    .: Rishi :.

  6. #6
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Update input box via link

    nuts to it, its like 1 line of code.
    Code:
        <input id="Text1" type="text" name="Text1" value="sss" /><br />
        <table onclick="Text1.value =Text1.value +', '+ window.event.srcElement.innerText;">
           <tr><td>hello</td></tr>
           <tr><td>world</td></tr>
        </table>
    throw new ArgumentException (String, String, Exception)

  7. Received thanks from:

    Raz316 (15-10-2007)

  8. #7
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: Update input box via link

    Cheers TheAnimus, I'll check the IDE out.

    As for the example code, thanks, but that specifically changes a certain input (ie 'text1'). I'd like to be able to change the 'current' input box. That possible?

  9. #8
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Update input box via link

    Ah so its not just one box?

    If its a case of you've got two or more boxes, you want to let them click somewhere, and then the box which had focus gets updated?

    If so you will have to have a variable, which stores the old focus. using the onFocus event you need to define a variable (call it lastSelectedInputBox say) then on the onClick, instead of updating the imaginativly named Text1, update that.
    throw new ArgumentException (String, String, Exception)

  10. Received thanks from:

    Raz316 (15-10-2007)

  11. #9
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: Update input box via link

    aha! that makes sense, thank you Yeah that was the problem I saw, on clicking a link the focus is lost, but I never considered using a variable, so I will do that tomorrow!

    thanks again

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Xbox 360 dash update
    By Steven W in forum Console
    Replies: 0
    Last Post: 21-09-2007, 08:25 AM
  2. need help to connect NTL box to Viewsonic LCD monitor!
    By bargaindoctor in forum Help! Quick Relief From Tech Headaches
    Replies: 2
    Last Post: 30-09-2006, 05:26 PM
  3. ntl box to play on LCD with DVI input?
    By bargaindoctor in forum Consumer Electronics
    Replies: 4
    Last Post: 26-09-2006, 11:03 AM

Posting Permissions

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