• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • 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
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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: 842
1
  • Mark post as helpful
  • send pies
  • 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: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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: 842
1
  • Mark post as helpful
  • send pies
  • 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: 842
1
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic