• 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

Struts2 UI - Change / Set UI component attributes dynamically

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is it possible to change / set the attributes of struts2 UI component dynamically..As an example i will take the following example..

Suppose we have 10 text boxes on a page [<s:textarea>], out of which 5 are necessary and the rest are optional for a user to input data into.
So not to confuse the user i would want to just display 5 by default and give a button for example..lets say "More" which when clicked makes the other 5 visible on the form and the user can input data into these..
I tried to do exactly this but seems that there are problems with java script and the struts2 tags, opening a pop up window and asking the user to input to enter values in that window, take the values back to the parent form as hidden values seems a little cumbersome.

Can anybody let me know of how to achieve this kind of a functionality in Struts2 by changing the attributes, in our case for example disabled attribute or visible attribute (although, i think that this property is not available)..

Thanks a ton in advance..
Regards,
Am
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you need to add input elements dynamically why not just use JavaScript?

That aside, the "cssStyle" attribute lets you set styles.
 
amol bakre
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Oh, i am not much aware of the css etc, javascript did not seem to work properly with struts2, just used script tag directly in the page and tried to refer to the elements but javascript does not recognize the struts2 elements, for example <s:textarea>.
I am not very good with css and javascript or jsp's, had only been writing servlets, ejb's, beans, now springs etc..
Can you help by maybe citing example..

Many thanks..
Regards,
Am
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't use custom tags when creating elements via JavaScript; you create them by hand.
 
amol bakre
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

mm..okay..

Thanks..
Am
 
reply
    Bookmark Topic Watch Topic
  • New Topic