• Post Reply Bookmark Topic Watch Topic
  • New Topic

ideas to disable button

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i understand that the button can be disable by javascript , my question is let assume i have a form with 3 buttons ..i want to decide which button can be use by user though the user access level , and it will based on database data , is it possible i can pass some data into javascript to detected for button disability ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's based on information in a database, you can do it from the server.
Just add a " disabled " attribute to the button tag.

Better yet, if the user is never going to be able to click a given button anyway, don't show it to them.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To add a small example to Ben's suggestion:


If the attribute 'permission' is set in the request (or session) the field is an input field that can be edited.
If the attribute is not set the value is presented as read only, the user never sees it as an editfield nor does he see the button.

bloody smilies
[ March 11, 2005: Message edited by: Jeroen Wenting ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!