• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

changing form input fields in the div

Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a page that has different div's. The value gets passed between the div using Javascript. FOr example, One form has a array of radio button that has other information like id, name etc as hidden fields. On selection the radio button, some other div becomes visible with the values of the form of the new div prefilled with that of previous div form through Javascript. Now, My problem is:
I want the input type of the new form to be either input box or a dropdown menu depending on the value that's being passed to me. If it was JSP, i would know how to do it but since i'm not sending any request to the server, i guess i have to do it in Javascript(i'm not allowed to redesign the whole page). SO, could someone please guide me in the right direction??. I would really appreciate it.

Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not completely sure I have a handle on what you're asking, but I think you could write a little JavaScript function that replaces the string of text inside of a span tag (or maybe a div tag as well?). Take a look at these and see if they help:



Posts: 15385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just show and hide content on the page.

document.formName.elementName.style.display="none"; //hide
document.formName.elementName.style.display="inline"; //show
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic