How to disable Buttons based on condition.

Hi
Need your help to disable button based on condition.
Please refer the application:
http://apex.oracle.com/pls/otn/f?p=34797:5:110582943383419::NO:::
login credentials:
workspace: vsanthanam
user: vijay
pswd: apex_demo
In the above application, i have 2 buttons in page 5, (Report1 and Report2)
Where i have to disable button based on the following conditon:
i) USER whoever has Admin value 'Y' in my table can access the button.
for this i've written a Button Condition : Type (EXISTS)
select 1 from apex_extra_values where rtrim(lower(empname)) like decode((select Admin from apex_extra_values
where rtrim(lower(empname))=rtrim(lower(V('APP_USER')))),'Y',rtrim(lower(V('APP_USER'))))
note: i have empname same as my APEx user name. with Admin access 'Y'.
By using this code i can able to hide the button for users who has no Admin access.
But my requirement is : i have to show the button even if the user is not Admin, but to grey out (disable the button - no action)
I tried using javascript function:
function disableButton(pThis)
pThis.disabled=true;
But either of this (exists condtion or JAvascript function) works in my case and not both.
Any pointer on this would be highlt appreciated.
Thanks
Vijay

Couple of things:
1. I would never use v('APP_ITEM') but :APP_ITEM - it is faster and there is no need to use this function within an application
2. The way you are doing this check is not the best approach. You should create an authorization schema and run this once per session. Whatever this authorization is returning as a result you can check using the following Function returning boolean:
IF apex_util.public_check_authorization ('MY_AUTH') THEN RETURN TRUE; ELSE RETURN FALSE; END IF;
See this example on authorization issues:
http://apex.oracle.com/pls/otn/f?p=31517:148
3. As far as disabling a button is concerned I think I explained the options. I also have an example on that here:
http://apex.oracle.com/pls/otn/f?p=31517:143
whereby it is not disabling but hiding a button.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------

Similar Messages

  • How can hide the buttons based on condition

    Dear all
    I have to hide the button based on condition
    When I open the third page directly I want to hide that button
    When I open the third page via first and second page I need to visible that button
    I pass spell parameter from first to second and second to third
    In third page I get the value using pagecontext
    I write the code in third page co
    If I go directly third page it is null
    If I go to third page via first the value is Y
    If(“Y”.equals(pmode))
    OASubmitButtonBean btn =( OASubmitButtonBean )webBean.findChildRecursive(“<id>”);
    If(!btn=null)
    btn.setrendered(true);
    else
    btn.setrendered(false);
    but the button is not hiding
    Regards
    Sreekanth

    Hi Srikanth,
    I have modified ur method:
    OASubmitButtonBean btn =( OASubmitButtonBean )webBean.findChildRecursive(“<id>”);
    If(btn !=null)
         If(“Y”.equals(pmode))
         btn.setrendered(true);
         else
              btn.setrendered(false);
    Thanks,
    'Kumar
    Edited by: Kumar Kovela on Aug 3, 2009 5:53 AM

  • How to disable buttons in HTML?

    How to disable buttons in HTML?
    For example.. In my application when one button is clicked then it should disable some buttons and should be able to perform any other actions...

    Correct me if i am wrong.. i think we should not use '[' but '('
    document.getElementById('buttonname').disabled = true;

  • How to: disable buttons in standard forms

    Hi all,
    does anybody know how to disable session date button from standard forms?
    I cannot find in forms (through Form Builder) the right data block / canvas where this button is.
    Thanks all.
    Jacopo

    I'm not aware of any "session date button". A button on a form can be disabled using the set_item_property.
    Use the layout editor and double-click the button. It will tell you what button it is. The button will also be highlighted in the Object Navigator window.
    Message was edited by:
    Mark Roberts

  • How to disable button once user click once in an Applet?

    Hi,
    We are facing an issue with Applet level button.
    User is clicking multiple times on button and we don't want to allow users to click multiple times.
    So that How to disable the button after clicking once.
    Thanks,
    Sandep.

    Since you don't saying what version of Siebel you are on, I assume
    8.0 or later.
    You can use this on if you applet class is CSSFrame, CSSFrameList, or any of their subclasses.
    On the applet add, Applet User Prop:
    Name
    CanInvokeMethod: InvokeWF
    Value
    [DisableButton]='N' OR [DisableButton] IS NULL
    More info here:
    http://download.oracle.com/docs/cd/B40099_02/books/ToolsDevRef/ToolsDevRef_UserProps6.html
    On the applet add, Applet User Prop:
    Name
    Named Method
    Value
    "InvokeWF", "SET", "DisableButton", "Y"
    More info here:
    http://download.oracle.com/docs/cd/B40099_02/books/ToolsDevRef/ToolsDevRef_UserProps21.html
    Make sure the field DisableButton is active (Use Force Active on BC if the field isn't active)
    Make sure the field has "Immediate Post Changes" set to true on the BC.
    Axel
    PS: Don't use scripts if you can solve the problem with user props, WF, .... Scripting should
    be you last resort.

  • How to disable buttons in ADF form so it can be reused

    I would like to reuse the same Human Task ADF form for multiple User Activities in the same BPM 11g process definition.  The only difference between the User Activities in the process are the outcomes (buttons) allowed.  For example, in some User Activities, the outcomes allowed are APPROVE and REJECT.  In others, it might be APPROVE, REJECT, and REPROCESS.  Is it possible to hide, or disable, buttons in a Human Task ADF form based on some settings done in the User Activity, or something passed to the Human Task ADF form?
    I started digging, and I see in the jspx file for the form, there is an attribute named "visible" that is set as follows on the button:
    <af:commandToolbarButton actionListener="#{invokeActionBean.setOperation}"
                           text="#{wf:getResourceValue('APPROVE', 'bindings.customActions')}"
                           disabled="#{!bindings.APPROVE.enabled}"
                           action="#{invokeActionBean.invokeOperation}"
                           partialSubmit="false"
                           visible="#{wf:isCustomActionAvailable('APPROVE', 'bindings.customActions')}"
                           id="ctb2">
        <f:attribute name="DC_OPERATION_BINDING" value="bindings.APPROVE"/>
    </af:commandToolbarButton>
    So if I can figure out a way to pass flags to the form, and then use those in the setting of the "visible" flag, would that do it?  Is there a better method?
    Thanks,
    Joe A.

    Set the binding to the button in the managed bean based on the input form parameter. For example if parameter value is paramValue1
    <task-flow-definition id="sourceTaskflow">
      <input-parameter-definition>
          <name>inputParameter1</name>
          <value>#{pageFlowScope.paramValue1}</value>
          <class>java.lang.String</class>
       </input-parameter-definition>
    </task-flow-definition>
    Set binding to not enabled.
    #{!bindings.CreateInsert.enabled}
    Some relevant references
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/oct2010-otn-harvest-183714.pdf
    Using Parameters in Task Flows

  • How to disable domain based and normal  cookies in e-tester 8.3?

    Hi all,
    Is there any way to disable domain based and normal cookies in e-tester 8.3 verson ?
    thanks
    Edited by: USoni on Jan 28, 2009 11:23 PM

    What do you mean by disable?
    there are setting available which affects Cookies in Script Setting - Script - Automatic Actions

  • Account Mgmt - How to disable buttons ?

    Hi,
    While dealing with an account, how can we disable a particular button for a particular set of users.
    e.g. if i log in as a Marketing Professional, i should see the EDIT button while on an account page, whereas if i login as a Sales Professional, i should not be able to EDIT the account.
    Is this kind of role based access possible at the WEB UI ?
    Let me know.
    Thanks,
    Prish

    Hi Prish,
      By using the below statment you can read the role which you logged in.
    lv_brole = cl_crm_ui_profile=>if_crm_ui_profile~get_user_defined_profile( ).
    Once you get the role you can disable your EDIT button by setting button-enabled = 'FALSE'.
    Regards,
    Lakshmi.Y

  • How to disable button immediately after pressing

    Hi
    In my save button there is a code for insertion of data in database.
    In my application when i press save button first time the IE progress bar shows progress but if suppose the user presses the button again
    then the data wil get saved twice.
    Now if i put a code in button action method to disable it will function only when it will be called in between user can press the button.
    How to arrest users for clicking???
    If you have any idea please help me out.

    How about setting the button to:
    yourButton.setVisible(false);
    So when your button action is called, this is the first action that is called before your code insertion lines so the button will disappear when clicked e.g.
    public String yourButton_action {
    yourButton.setVisible(false);
    ....code insert data......
    return null;
    Or set the "return null" to return a new page.
    Of course, if you wanted it to be visible again after the insertion then you would set
    yourButton.setVisible(true);
    Alternatively, you could setup a counter that would check the number of times the button was pressed and make the button visible (or invisible!) when conditions are met.

  • How to disable buttons in Search help screen ?

    Hi All,
    How do we disable Print button in customer search help ?
    We want that nobody should be able to take a printout of Customers from Search help result. Hence we want to disable the print button which comes in Search help.
    Any idea how do we go about it ?
    Regards,
    Ashish

    Hi there,
    you should be able to do that with the search help exit. Try replacing the PF-STATUS for instance. I am not sure if this works though!
    For instance:
    IF call_control-step = 'PRESEL'.
    SET PF_STATUS 'ZZ' OF PROGRAM 'ZZZ'
    ENDIF.
    Or you might call the existing PF-STATUS and use EXCLUDING.
    Roy

  • How to show view based on condition

    Hi,
    I have a scenario with login screen with a submit button and two views(success and error).
    Now I want to show
    a)a successful view if user enters a correct login name and password(which will be validated with static values in action method of submit button)
    b)a Error view if user enters wrong username and password.
    I am struck at action code to write a condition to show respective views.
    Some thing like (In Java)
    If (login.id=='abc' && login.password='xyz')
    show.view1
    else
    show.view2
    I am not familar to ABAP coding as I just started to know.
    If anyone know action code, Please help on this.
    Thanks in advance
    Praveen

    Hi Suman,
    Thanks for the code. my issue is still not solved
    I have to change the code with respect to context node info.
    My context looks like
    Root
       ->Person
             -->Name
             -->Address  (which is designted as password)
    Now how to do modify your code with respect to the context. I'm sorry I m new to ABAP coding.I tried with below changed code.it gave me an error as shown in below.(type if_first=>element_name is unknown)
    method ONACTIONACTION_GO .
    data:
        node_input_data  type ref to if_wd_context_node,
        elem_input_data  type ref to if_wd_context_element,
        stru_input_data  type iffirst=>element_name._
    navigate from <CONTEXT> to <INPUT_DATA> via lead selection
      node_input_data = wd_context->get_child_node( name = 'PERSON' ).
    get element via lead selection
      elem_input_data = node_input_data->get_element(  ).
    get all declared attributes
      elem_input_data->get_static_attributes(
        importing
          static_attributes = stru_input_data ).
    if stru_input_data-name = 'praveen ' and
      stru_input_data-address = 'ilkal'.
    Navigate to view1
      wd_This->Fire_Outtov2_Plg(
    else.
    Navigate to View2
    wd_this->fire_<plugname>_plg(
      wd_This->Fire_Outtov2_Plg(
    endif.
    endmethod.
    Error:
    type if_first=>element_name is unknown  (why this error..?)
    Thanks
    Praveen
    Edited by: Praveen kumar Kadi on Sep 12, 2008 9:38 AM

  • How to disable a Checkbox with condition.

    Dear experts,
    I am doing a module pool program. My questyion is, the program has a checkbox. After certain process, let's say if it met a IF condition. This checkbox needs to be disabled. No matter the checkbox previously is ticked or without tick. The checkbox need to be completely disabled.
    Please advice how should I do it. As I have search in the forum for some time, but I could not get my answer.
    Appreciate if someone can help. Thanks in advance.

    Hi,
    3 problems.
    1. U r using lower case for check boxes screen name
    2. Screen-invisible is used to make data of the parameter invisible while typing eg: PASS WORD.
    3. What ever modification we are doing is over written in AT SELECTION SCREEN OUTPUT event.
    use screen input attribute as i told earlier.
    AT SELECTION SCREEN OUTPUT is analogous to PBO of
    Dialog program
    Check below modified code. It is working fine now.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      tt = 'Example'.
      chk1 = 'X'.
    AT SELECTION-SCREEN OUTPUT.
      IF radio1 EQ 'X'.
        LOOP AT SCREEN.
          CHECK screen-name = 'CHK2'.
          screen-input = 0.
          MODIFY SCREEN.
          EXIT.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          CHECK screen-name = 'CHK1'.
          screen-input = 0.
          MODIFY SCREEN.
          EXIT.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN ON BLOCK b1.
      CASE sy-ucomm.
        WHEN 'R1'.
          IF radio1 = 'X'.
            CLEAR chk2.
            chk1 = 'X'.
          ELSEIF radio2 = 'X'.
            CLEAR chk1.
            chk2 = 'X'.
          ENDIF.
      ENDCASE.
    I hope u r clear now.
    Thanks,
    Vinod.
    Edited by: Vinod Reddy Vemuru on Jul 29, 2008 4:33 PM

  • Disable Button based on PL/SQL call

    I have a PL/SQL Function in the database that returns a zero if a condition is true or non zero if false.
    I wrote a custom method in my Application Module named canReadSubmission to call this function. The first try at this returns a boolean. I exposed the method to the client.
    Now I'm working in my JSF page, and I want to set the Disabled property on a button, so that the button is enabled if the function returns "true" or disabled if the function returns "false".
    I added an action binding to the method in my Application Module (a methodAction) to the PageDef for the page. I also added an invokeAction to the executables section with Refresh="always". Then I set the Disabled property for the button to "#{!bindings.canReadSubmission.result}
    I'm getting the following message:
    JBO-25221: Method TEDSAppModuleDataControl.dataProvider.canReadSubmission() not supported
    Any ideas?

    Yes I exposed the method through the BC client interface.
    Yes I created a method binding in the pageDef (by the way, the method has two parameters which I set to two of the attributes in a bound iterator from the same pageDef)
    And yes, the method is declared as returning a boolean, which I do set to true or false.
    I also added an "invokeAction" tag to the executables section of the pageDev file - since I discovered that the method wasn't being executed at all without that.
    Some attempts at debugging showed that the error occurs upon call - the method is never actually entered. One thing I happened upon in my research - one reference (now I can't find it again.) seemed to say that if the method returns anything, it needs to return an Object - which I'm not doing, I'm returning a scalar - a boolean. Does this ring a bell with anyone?

  • How to disable button immediately after click?

    Hello,
    I'm using JDeveloper 11.1.1.4.0
    On my screen is an 'Add' button that calls specific method written in bean (addAction). Following are actions in addAction():
    1. Disable Add button
    2. Execute 'CreateInsert'
    3. adfContext.addPartialTarget(corresponding adf table)
    This works fine when user clicks on 'Add' and waits for couple of seconds, till the 'Add' button gets disabled
    However, if the user keeps on clicking 'Add' button, it sends multiple requests to server and adds those many records in 'adf table'.
    Is there any way to stop user input till the response is received for the previous request?
    I tried setting up 'blocking' property of the button. But it did not work.
    I also tried using 'unsecure' property of the button for disabled property and call setProperty('disabled',true) in javascript. In this case server request is not sent.
    Appreciate your help in this regard.
    Amar

    hi user,
    i cant undertud ur problem.. but i understud that something disabing the button.
    <af:commandButton text="Entry completed" id="cb23"
    binding="#{pageFlowScope.managedbean_GeneralLedger.cb23}"
    action="#{pageFlowScope.managedbean_GeneralLedger.cb23_action2}"
    disabled+="#{bindings.GlLvlAccounts1.estimatedRowCount eq 0 ? 'true' : 'false'}" // here whatever ur condition.
    partialSubmit="true"
    />
    af:command button disabled

  • How to disable buttons when another button is clicked

    I have an application with 5 buttons that each play or pause
    different movieclips. How can I prevent other buttons from playing
    different movieclips when a movieclip is already playing.

    I looked in the help and found an example actionscript. I
    changed the button instance names to the button names in my app. I
    put the actionscript on frame 1 that holds the movieclip being
    played. Here it is
    mycase3_btn = true;
    mycase1_btn = false;
    mycase2_btn = false;
    //button code
    // the following function will not get called
    // because myBtn2_btn.enabled was set to false
    mycase1_btn.onRelease = function() {
    trace( "you clicked : " + this._name );
    mycase2_btn.onRelease = function() {
    trace( "you clicked : " + this._name );
    mycase3_btn.onRelease = function() {
    trace( "you clicked : " + this._name );
    It doesn't disable the other 2 buttons. As may be obvious I
    am new to all but the simplest actionscripts. What am I doing
    wrong?
    thank you for your time!

Maybe you are looking for