• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Enabling/Disabling buttons in JSP

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Is ther any ways to enable/disable buttons in JSP, based on the value what i select in the combobox ??
i.e) If i select the value "Yes" in the combobox, corresponding buttons
should be enabled and
If i select the value "No" in the combobox, corresponding buttons
should be disabled.
I'm using Struts framework for my application.

Suggestions are welcome.

thanks
Vikas
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The best way to do this is with JavaScript. By specifying the "onchange" event in your <html:select> tag, you can cause the execution of a function that will disapble or enable buttons on your form. If you don't know enough about JavaScript to do this, I'd suggest spending some time with JavaScript tutorials before attempting it.
 
vikas bala
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Merrill.

I tried to do this is with JavaScript.
By specifying the "onchange" event in the <html:select> tag,

However, I'm using <html:button> and I see its not enabling/disabling dynamically based on the combobox value.

vikas
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is probably due to an error in your JavaScript code. Please show us the code.

Hint: If you specify styleid="button1" for an html:button, you can then use the statement:

to disable the button.
 
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic