Results 1 to 4 of 4
  1. #1
    kalyana is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default Please help : JSP enable/disable button

    Hi all.....
    I want set my button enable / disable depend on the data . for example : if data = 1 , button will enable and otherwise.But i don't know how to do that in JSP .
    hope any one can show me some example to do that ....

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    You can make it to use js. for example
    Java Code:
    function setEnableDiebale() {
                var result = <%=price.isPriceDate(sc)%>;
                var button = document.getElementById("buttonId");
                button.disabled = result;
    }
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    kalyana is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default

    thanks Petr...

    if there , i added button and set name = "buttonId" .How i call that function ( function setEnableDisable () ) in my jsp ....

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    I can't remember my JSP tags, but you could simply:
    Java Code:
    <button type=button <c:if do your check here>disabled</c:if>/>
    Something along those lines.
    Save on writing javascript for starters.

    Wouldn't be surprised to find there was a neater way, but you really don't need to go down the Javascript route.

Similar Threads

  1. Disable Radio button
    By AJG in forum New To Java
    Replies: 3
    Last Post: 05-10-2011, 11:09 AM
  2. Disable Maximize button in JFrame?
    By Manish87 in forum AWT / Swing
    Replies: 0
    Last Post: 02-01-2011, 03:39 PM
  3. use javascript to enable/disable hyperlinks
    By sauravsinha in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 04-22-2010, 06:04 PM
  4. Disable the WebBrowser Back button
    By Deepa in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-26-2008, 09:10 PM
  5. How to use "selectOneRadio" to enable/disable a Picklist
    By vivekbakshi in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 04-07-2008, 03:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •