aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Want to create dynamic form and fields on click of a menu button. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Want to create dynamic form and fields on click of a menu button." Watch "Want to create dynamic form and fields on click of a menu button." New topic
Author

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

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 644
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

Joined: Oct 29, 2001
Posts: 8900
    
    8

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


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 644
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

Joined: Oct 29, 2001
Posts: 8900
    
    8

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

Joined: Jul 07, 2012
Posts: 644
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

Joined: Jul 07, 2012
Posts: 644
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Want to create dynamic form and fields on click of a menu button.