• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Want to create dynamic form and fields on click of a menu button.

 
Ranch Hand
Posts: 2925
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a menu of click of button 1 a struts form and fields will be created. On click of button 2 instead a different form and filed should be created. Should this be done using Jquery or any other way?

I tried doing this using Jquery using below code but it did not work.





I am having this at the top:



thanks
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no shortage of examples, both using javascript and jquery.
Note that if you are using the Struts jQuery plugin, you need to include the tags:

and use the sj:head tag to initalize jQuery
 
Monica Shiralkar
Ranch Hand
Posts: 2925
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I got one way of doing this: using Javascript Hide and Show. Show the desired form and hide the rest. Is this a proper way?
thanks
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't recall any of the examples I've pointed to using show and hide. Will you run out of extra fields? If not, perhaps your solution will work.
 
Monica Shiralkar
Ranch Hand
Posts: 2925
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying this functionality: I have 2 buttons : click1,click2
If I click on Click1: In the same area only the contents of Div 'toggleText1' should be displayed.Rest should be hidden.
If I click on Click2: In the same area only the contents of Div 'toggleText2' should be displayed.Rest should be hidden.


To achieve this I tried the below but at a time more than 1 div is displaying(I want a single div to be displayed at a time not all,others should be hidden):







At a time only form 1 or form 2 should be displayed not both.

Please advice.
thanks
 
Monica Shiralkar
Ranch Hand
Posts: 2925
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The strategy I am using is: show one div(related to the menu selction) and hide each of other menu item. Then for other option click: show one div(related to the menu selction) and hide each of other menu items. Is this strategy fine?But is tedious ;is there any easier way I can do this(hiding each of other menu items is long process).

thanks
reply
    Bookmark Topic Watch Topic
  • New Topic