SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: dynamic form

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic form

    Dear all,

    i have a form, one of the fields is a dropdown menu with 2 options. i would like a new text box to be displayed on the same page if the user selects the second option from the dropdown menu. is this possible?

    I am a javascript beginner, so I would appreciate if someone has example code to show me.

    many thanks

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    make an input type text and set the style display none
    then use onchange event and make the object visible
    Code:
    onchange="if(this.options[this.selectedIndex].value=='2') document.getElementById('inputId').style.display='block'; else document.getElementById('inputId').style.display='none';"
    cheers


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
  •