• 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

creating button using <s:button> - similar to the CSS based button

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

I am having a JSP with simple form.Here these things are to noted
1. using <a..><span> to create a button using CSS with sliding-door approach. The image can be seen in the attachment.
2. submitting the form on press of Enter key in the form area - the code in the form tag
3. submitting the form after doing a client side check for valid inputs

I want to convert this form with struts tag based form i.e. <s:form..>. However I am facing some problems in
1. converting the button HTML with <s:submit...> tags to create button
2. apply the enter key event capture and submit for there after. (onKeyDown is not a valid attribute for <s:form -tag)
3. can we still do the JavaScript validation

I am not able to figure out, as how to achieve these results. Any help in this regard will be highly appreciated. Thanks in advance guys. >
bg_button_blue_a.png
[Thumbnail for bg_button_blue_a.png]
the image that we used to create button
 
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
Did you try using "onkeydown"? The CamelCase attribute names aren't really the norm anymore.
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a reasonably complex HTML layout--you're either going to want to create your own theme or just continue doing the form's internals by hand. You might need to tweak the form element names to conform to what S2 expects, but in general the form element names are just the names of the corresponding action properties.
 
Shashank Rudra
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
great, wat you said about the naming standards is correct (I cross checked with the view source). So following the same here is the new form tag. But still not able to get the desired result. Thanks pal for your efforts in helping me out.


Actually wat is happening here is (when I saw the view page source) The form tag is being rendered as As apparent the js code is being scrapped. How to retain that piece in the resulting form Tag.
 
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
Looking in the form-common template it does, indeed, appear to ignore the "onkeydown" attribute (don't know why).

Which version of S2 are you using? At some point the ability to use dynamic tag attributes was added, but I don't recall when that was (or if it's a taglib-wide setting).
 
Shashank Rudra
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Tomcat5.5 i.e. JSP2.0. Though I am not sure - if this is what you asked for.
 
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
No, I asked what version of S2 (Struts 2) you're using.
 
Shashank Rudra
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for being in slumber so long - but was actually not able to post it due to network latency on my side.. I am using Struts 2.0.6 here.
 
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
Oh; that's pretty old--the dynamic attributes was definitely added well after that version.
 
Shashank Rudra
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh ok. thanks ne ways.
 
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic