Handling Button Event

Hi all,
i am using a 'When-Validate-item' trigger in this i am doing a validation,
when user try to enter amount greater than the given amount(This is needed validation)
and also i am regenerating new lines(Creating new records when button pressed)
when i am regenerating i should not validate.
How to handle button event
Thnx
Raj

Hi...
The WHEN-VALIDATE-ITEM Trigger fires once you updated a field. Be sure you raise
form_trigger_failure when amount is invalid. So, the cursor stays in field amount. You cant
leave this field until the amount is not valid.

Similar Messages

  • Handling button events in large app

    I'm currently examining a large swing app, and have observed the following with regard to action events.
    A number of listeners (for buttons, menu items, JLists etc.) are defined at the top of the app. These variously extend MouseAdapter or implement ActionListener, depending on the type of component whose actions they listen for.
    The ButtonListener definition is as follows :
    private class ButtonListener implements ActionListener
    public void actionPerformed(ActionEvent event)
    Object object = event.getSource();
    if (object == button1)
    // button1 actions
    else
    if (object == button2)
    // button2 actions
    .....etc
    One instance of this listener is created in the app, and is used as the actionlistener for each button. This means that the buttonlistener is quite large (as it contains the code for each button in the app).
    Is this the proper way to handle button events for an app with a large number of buttons?

    Thanks for the responses.
    In response to theDude : I agree that defining the action listener for each button can be useful when you can see the button definition and button action in one place; one could counter that by saying that grouping all the button actions makes it easier to examine all button actions in one place.
    Setting the action command isn't really an option because the application creates panels of buttons on the fly, e.g. when notification of a new customer is received, a new panel is created with a JTextPane (customer description) and a row of buttons for "Modify", "Delete" and "Print".
    Several customer panels could be in existence at the same time, so setting an action command of "Modify" would not enable one to uniquely identify which "Modify" button was pressed.
    This problem is currently handled by associating the panel instance with a "Customer" class instance in a hashtable. The "Customer" class consists of a JTextPane field, and a JButton for each function. When a button is pressed, the button listener traverses up the component's parents until it reaches the panel (i.e. it loops until the parent is a key on the hashtable, at which point it can retrieve the Customer instance and check which button was pressed).
    In response to KPSeal : If I understand you, I would define "ApplicationAction" separately from the main app and define extensions of it in the main app for each type of action. Would this add much value over merely defining a method for each type of action in the main app and just calling this method when the relevant button/menu item was pressed/selected?
    There doesn't seem to be a universal approach to event handling, but I thought there might have been one accepted strategy when an app has large numbers of buttons (some created on the fly, ruling out action commands).

  • Handling button events for dialog boxes of a used component

    Hello,
    After I call a dialog box/window for the view of the used component, how can I handle the button events of the window that I called?
    I create the window using the method CREATE_WINDOW_FOR_CMP_USAGE of the interface IF_WD_WINDOW_MANAGER. This method returns window reference of type IF_WD_WINDOW.
    Thanks & Regards,
    Reena

    It's very easy.
    Have a look to the document: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9e242bf5-0901-0010-c99c-83c180163c73
    You will find the SUBSCRIBE_TO_BUTTON_EVENT on page 6.
    Sergio

  • Handle button event of popup created from component controller

    Hi all,
    I have created a method for created popup in the component controller with button kind 'yes-no'.Now i use it in the view.
    Till here all is working fine.
    Now i want to use the events which triggers on the popup (yes, no).Any idea how to trigger these buttons action.
    The problem i am facing here is: When i use <b>subscribe_to_button_event</b> method it does not working.
    Any ideas how to use this.
    Points will be sured.
    Sanket sethi

    hi sanket.........
    here is a code snippet... check this out.
    data: l_cmp_api          type ref to if_wd_component,
            l_window_manager   type ref to if_wd_window_manager,
            l_popup            type ref to if_wd_window,
            l_text             type string_table,
            l_api              type ref to if_wd_view_controller.
      l_cmp_api        = wd_comp_controller->wd_get_api( ).
      l_window_manager = l_cmp_api->get_window_manager( ).
      insert `Data where changed` into table l_text.   
      insert `Do you want to save?`        into table l_text.   
      l_popup = l_window_manager->create_popup_to_confirm(
                    text            = l_text
                    button_kind     = if_wd_window=>co_buttons_yesnocancel
                    message_type    = if_wd_window=>co_msg_type_question
                    window_title    = 'Test: Popup to confirm'
                    window_position = if_wd_window=>co_center ).
      l_api = wd_this->wd_get_api( ).
      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_yes
                   action_name       = 'YES'
                   action_view       = l_api
                   is_default_button = abap_true ).
      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_no
                   action_name       = 'NO'
                   action_view       = l_api
                   is_default_button = abap_false ).
      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_cancel
                   action_name       = 'CANCEL'
                   action_view       = l_api
                   is_default_button = abap_false ).
      l_popup->open( ).
    --regards,
      alex b justin

  • Not handling button event?

    //package com.ociweb.preferencestest;
    import java.awt.event.*;
    import java.util.prefs.*;
    import javax.swing.*;
    * A frame to test some basic functionality
    * in the Preferences API
    * @author Object Computing Inc.
    public class PreferenceTestFrame extends JFrame implements ActionListener {
    // A reference to a Preferences object
    private Preferences myPreferences = null;
    // Default values for this frame's preferences
    public static final int DEFAULT_WINDOW_X = 50;
    public static final int DEFAULT_WINDOW_Y = 50;
    public static final int DEFAULT_WINDOW_WIDTH = 300;
    public static final int DEFAULT_WINDOW_HEIGHT = 100;
    // Keys for this frame's preferences
    public static final String WINDOW_X_KEY = "TEST_WINDOW_X";
    public static final String WINDOW_Y_KEY = "TEST_WINDOW_Y";
    public static final String WINDOW_WIDTH_KEY = "TEST_WINDOW_WIDTH";
    public static final String WINDOW_HEIGHT_KEY = "TEST_WINDOW_HEIGHT";
    public PreferenceTestFrame() {
    setTitle("Preferences Test Window");
    // Obtain a references to a Preferences object
    myPreferences = Preferences.userNodeForPackage(PreferenceTestFrame.class);
    // Retrieve the location of the frame from the Preferences object
    int windowX = myPreferences.getInt(WINDOW_X_KEY, DEFAULT_WINDOW_X);
    int windowY = myPreferences.getInt(WINDOW_Y_KEY, DEFAULT_WINDOW_Y);
    // Retrieve the size of the frame from the Preferences object
    int windowWidth =
    myPreferences.getInt(WINDOW_WIDTH_KEY, DEFAULT_WINDOW_WIDTH);
    int windowHeight =
    myPreferences.getInt(WINDOW_HEIGHT_KEY, DEFAULT_WINDOW_HEIGHT);
    // Set the size and location of the frame
    setBounds(windowX, windowY, windowWidth, windowHeight);
    JButton but=new JButton("Click me");
    add(but);
    but.addActionListener(this);
    setVisible(true);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    exitApp();
    public void actionPerformed(ActionEvent e) {
         if(e.getActionCommand == "Click me" )
         setbackground(Color.blue);
    private void exitApp() {
    // Save the state of the window as preferences
    myPreferences.putInt(WINDOW_WIDTH_KEY, getWidth());
    myPreferences.putInt(WINDOW_HEIGHT_KEY, getHeight());
    myPreferences.putInt(WINDOW_X_KEY, getX());
    myPreferences.putInt(WINDOW_Y_KEY, getY());
    System.exit(0);
    public static void main(String[] args) {
    new PreferenceTestFrame();
    On compliation I get the following error:
    ---------- javac ----------
    PreferenceTestFrame.java:59: illegal start of expression
    public void actionPerformed(ActionEvent e) {
    ^
    PreferenceTestFrame.java:76: ';' expected
    ^
    PreferenceTestFrame.java:76: '}' expected
    ^
    3 errors
    Output completed (0 sec consumed) - Normal Termination
    Wheres the problem?

    sorry, the missing braces (}) should be placed below:
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    exitApp();
    } //missing
    public void actionPerformed(ActionEvent e) {
         if(e.getActionCommand == "Click me" )
         setbackground(Color.blue);
    }and some other changes that u need:
    import java.awt.Color;
    e.getActionCommand should be e.getActionCommand()
    setbackground() should be setBackground()
    hth.

  • How to show a message in a form 'PL/SQL Button Event Handler'

    We need validate the sal of an employee, and if it is bigger the value musts
    not be inserted.
    We trying a code like the one shown in the note 134312.1 'HOW TO PASS A
    PARAMETER FROM A PORTAL FORM TO A STORED PROCEDURE' and it works in the insert event of the insert button (using 'PL/SQL Button Event Handler') and it works, but we need to show a message that says the data wasn't inserted. How can we do this?
    The code we used is:
    declare
    v_deptno scott.emp.deptno%type;
    v_empno scott.emp.empno%type;
    v_sal scott.emp.sal%type;
    mySal scott.emp.sal%type;
    v_string varchar2(256);
    blk varchar2(10):='DEFAULT';
    begin
    select sal into mySal from scott.emp where empno=7369;
    v_deptno:=p_session.get_value_as_number(p_block_name=>blk,
    p_attribute_name=>'A_DEPTNO');
    v_empno:=p_session.get_value_as_number(p_block_name=>blk,
    p_attribute_name=>'A_EMPNO');
    v_sal:=p_session.get_value_as_number(p_block_name=>blk,
    p_attribute_name=>'A_SAL');
    v_string:='You just inserted empno: '||to_char(v_empno) ||'to deptno ->
    '||to_char(v_deptno);
    if mySal < v_sal then
    doInsert;
    else
    -- We want to display a message here, when mySal > v_sal
    end if;
    end;
    ----------------------------------

    I did something similar but wasn't using a stored procedure. Couldn't you set a flag variable once you know you're not doing the insert and in the "before displaying the form" section put an IF to check if your flag was set, and if so do an HTP.Print('You are overpaid buddy!');
    Then just reset your flag.

  • How to get a form field valud in delete PL/SQL Button Event Handler

    Hi Friend,
    I have a form. when user clicks delete button. we want to remove system dodelete function
    and add a delete script
    Under delete-top category,
    how can I get value of form EVENT_NUMBER field in form at delete PL/SQL Button Event Handler?
    DELETE FROM PTEAPP.PTE_EVENTS WHERE eventnumber = EVENT_number
    But when I try to save this form and get message as
    1721/15 PLS-00201: identifier 'EVENT_NUMBER' must be declared
    Thanks for any help!
    newuser

    I did something similar but wasn't using a stored procedure. Couldn't you set a flag variable once you know you're not doing the insert and in the "before displaying the form" section put an IF to check if your flag was set, and if so do an HTP.Print('You are overpaid buddy!');
    Then just reset your flag.

  • Custom Button Event Handler

    I'm working on a form that inserts data into my database. The normal Insert PL/SQL just does "doInsert". I want to add in the PL/SQL Button Event Handler a condition statement as follows:
    IF :new.name_id != null THEN
    doInsert;
    ELSE
    "do something else"
    END IF;
    "name_id" is one of the form items. I want to check the value in name_id before I insert it into the database. What is the correct verbage in order for this condition to work -- :new.name_id does not work.
    Thanks
    Susan

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Susan Miller ([email protected]):
    I'm working on a form that inserts data into my database. The normal Insert PL/SQL just does "doInsert". I want to add in the PL/SQL Button Event Handler a condition statement as follows:
    IF :new.name_id != null THEN
    doInsert;
    ELSE
    "do something else"
    END IF;
    "name_id" is one of the form items. I want to check the value in name_id before I insert it into the database. What is the correct verbage in order for this condition to work -- :new.name_id does not work.
    Thanks
    Susan<HR></BLOCKQUOTE>
    null

  • Is it possible to handle multiple events using Jscript for a button in Apex

    Hi,
    I've application wherein in one of the pages for a button, I need to trigger 2 events as: 1. redirect to a new page upon 'click' of the button
    2. display a set of values on 'mouse over' that button.
    I'm able to handle both separately, but not in one button. I would like to know if there is any limitation in Apex that we cant handle multiple events? Currently I've put a text item near the button, and called the Jscript for mouse over event in that as a temporary workaround. Can someone let me know if this is feasible? If not any other alternative to handle this?
    Thanks in advance,
    gsachidh

    Hi Gsachidh,
    well interesting problem you're facinng. Indeed, it can't be specified using the 'Button Attributes' So we have to come up with an workaround.
    A quick en dirty solution would be to specify it with the 'Optional URL Redirect options'. In a normal button, with processing on same page, this would be 'no target'. but in case of additional things to be done this can be used, using an target URL. I used this many times, in example with popUp windows for refreshing the caller object when changes are made. In your case we have to add next to the href an onmouseover event. this can be done with;
    Target set to => URL
    URL - target => javascript:doSubmit('<button_name>');" onMouseOver="javascript:showTooltip('tooltip');"
    Here the " is the key, letting ApEx know the target (href) is doSubmit('<button_name>'), just like when no target would be specified and adding a new javascript event; onMouseOver.
    Although this is a dirty solution in my opinion, it is the best i could come up with. I have another idea in how to do this, that is by adding this event dynamically with javascript with an addEvent. But i don't have an example at the moment for this scenario.
    Simon
    Message was edited by:
    S1M0N

  • Htp.p doesn't work from the custom button event handler ...

    Hi,
    I am trying to pop up an alert from the custom button event handler. I created a button and put the following code.
    htp.p('<script language='JavaScript1.3">
    alert ("Test Message");
    </script>;
    But alter doesn't show up after clicking the button.
    Thanks

    OK i've attached them and copy/pasted the relevent parts. The parent window is the SFLB file.
    -----------------------------------------here's the code in the parent window
    private function editServerPool():
    void
    serverPoolPUW = PopUpManager.createPopUp(
    this,popups.ServerPoolPopup,true);PopUpManager.centerPopUp(serverPoolPUW
    as IFlexDisplayObject); 
    if (newServerPool.SecondarySPAlgorithm != null){
    serverPoolPUW.enableSSCheckBox.selected =true;serverPoolPUW.DisplaySecondaryServerPool();
    serverPoolPUW.bigResize.play();// serverPoolPUW.height = 602; //yes...i know i need to move thisserverPoolPUW.switchoverPolicyCB.selectedItem = newServerPool.SwitchOverPolicy;
    serverPoolPUW.switchoverThresholdTI.text = newServerPool.SwitchOverThreshold;
    ----------------------here's the code in teh popup window (popups.ServerPoolPopup.mxml)
    <mx:Resize id = "bigResize" heightFrom="506" heightTo="602" target="{this}" /> 
    <mx:Resize id = "littleResize" heightFrom="602" heightTo="506" target="{this}"/>
     public function DisplaySecondaryServerPool():void{
    //make the screen large if the secondary server checkbox is selected; otherwise small.  
    if (enableSSCheckBox.selected){
    //display secondary server pool tab, expand the screen 
    //note that we cannot attach a data provider to the data grid until the grid creation is  
    //completed. This is done in an event handler.secondaryPanel.enabled =
    true; switchoverPolicyCB.visible =
    true;switchoverThresholdTI.visible =
    true;thresholdFI.visible =
    true;policyFI.visible =
    true;bigResize.play();
    else
     <mx:CheckBox label="Enable a Secondary Server Pool" width="264" fontWeight="bold" click="DisplaySecondaryServerPool()" id="
    enableSSCheckBox" fontSize="12" x="83" y="40"/>

  • Execute procedure in pl/sql button event handler

    i have a demo application which consists of text boxes
    eg : when i enter department no in first text box and click proc
    it should display dname and loc in the below text boxes.
    my proc is working fine in sql*plus but its showing errors in pl/sql button event handler.
    any ideas
    my proc is create or replace procedure proc1 (no number)
    as
    DNAME1 dept.dname%type;
    LOC1 dept.loc%type;
    begin
    select DNAME,LOC into DNAME1,LOC1 from scott.dept where deptno = no;
    DBMS_OUTPUT.PUT_LINE (DNAME1);
    DBMS_OUTPUT.PUT_LINE (LOC1);
         Exception When No_Data_Found then
    dbms_output.put_line('Entred name is not found');
    When Others then
    Null;
    End;
    /

    Hi,
    you have to use
    htp.p('<SCRIPT LANGUAGE="Javascript1.1">
    document.all("FORMNAME.DEFAULT.ATTRIBUTENAME.01").value="'||DNAME1||'";
    document.all("FORMNAME.DEFAULT.ATTRIBUTENAME.01").value="'||LOC1||'";
    </SCRIPT>
    instead of
    DBMS_OUTPUT.PUT_LINE (DNAME1);
    DBMS_OUTPUT.PUT_LINE (LOC1);
    where formname is your form name and attribute name is the field name on the page.

  • ALV Button event handling

    I have added a custom button on ALV toolbar of my web dynpro view. Now when user click that button, i want to implement the functionality...like onAction...How to do that...where do i need to write the code and how can i capture the button event...
    pls suggest

    Hi ,
    write following to create button:
    DATA: ui_btn1                     TYPE REF TO cl_salv_wd_fe_button.
      DATA: ui_sepa1                    TYPE REF TO cl_salv_wd_fe_separator.
      DATA: sepa1                       TYPE REF TO cl_salv_wd_function.
      DATA: btn1                        TYPE REF TO cl_salv_wd_function.
      data: lr_disp_button type ref to cl_salv_wd_fe_button.
      data: lv_button_text type string.
      CREATE OBJECT ui_btn1.
      CREATE OBJECT ui_sepa1.
      create object lr_disp_button.
    /to create new buttons...
      lv_button_text = 'Refresh Selection'.
      lr_disp_button->set_text( lv_button_text ).
    lr_disp_button->SET_IMAGE_SOURCE( 'ICON_DISPLAY' ).
      btn1 = l_value->if_salv_wd_function_settings~create_function( id = 'LSBUTTON' ).
      btn1->set_editor( lr_disp_button ).
    IN methods tab of view declare:
    ON_REFRESH     Event Handler     On refresh function pf ALV     ON_FUNCTION     INTERFACECONTROLLER     ALV
    in method ON_REFRESH write below code:
      DATA: temp TYPE string.
      temp = r_param->id.
      IF temp = 'LSBUTTON'.
    custom functional;ity
      endif.
    where :
    R_PARAM      Importing     1     IF_SALV_WD_TABLE_FUNCTION     
    This woudl solve ur purpose.
    Regards,
    Vishal.

  • How to add a custom PL/SQL code for a button event handler

    Hi All,
    I am a toddler in using Oracle Portal. So please forgive me for my ignorance.
    Q : How do I add a custom PL/SQL code for a button event handler?
    Basically, I would like to write MY PL/SQL function and call it. I could see that we can write "CUSTOM" code as "PL/SQL button event handler" in the form design window. But the question is that it expects only a "call" to procedure. But where do I define the procedure then? If I insert the procedure from the backend, it gets flushed the next time I compile my form.
    Hope I am able to explain my point.
    Thanks in advance,
    Abbas.

    Hi All,
    I am a toddler in using Oracle Portal. So please forgive me for my ignorance.
    Q : How do I add a custom PL/SQL code for a button event handler?
    Basically, I would like to write MY PL/SQL function and call it. I could see that we can write "CUSTOM" code as "PL/SQL button event handler" in the form design window. But the question is that it expects only a "call" to procedure. But where do I define the procedure then? If I insert the procedure from the backend, it gets flushed the next time I compile my form.
    Hope I am able to explain my point.
    Thanks in advance,
    Abbas.

  • 'Call' in PL/SQL button event handler

    I have created a form with only one 'Custom' button on it.
    In the PL/SQL button event handler, in 'Custom' event item, I
    inserted some PL/SQL code and, at the end, a call like the
    following:
    my_url:= 'PORTAL30.wwv_component_control.run_as_portlet?'
    || 'p_module_id=' || '2836550185';
    call(my_url,return_url);
    I have a compilation error:
    "PLS-00201: identifier 'CALL' must be declared"
    I also tried to put this code in 'On successful submission of a
    form'. I have no compilation error but it doesn't work.
    Anybody knows hw to solve this problem?
    Thanks.

    Hello Antonnella,
    I have a good tip for you:
    write the next scirp in the 'On successful submission of a
    form'field in the form where you want to call the component:
    declare
    l_url varchar2(2000);
    begin
    l_url := 'the url of the component you want to call' ;
    PORTAL30.wwa_app_module.set_target(l_url,'CALL');
    end;
    you can get the url from:
    develop -> call interface:show -> Example of Call from URL .
    Success,
    Haseeb

  • Unable to capture button event in pageLayout Controller

    Hi Guys,
    I have the following layout
    pageLayout
    pageLayoutCO (controller)
    ----header (Region)
    ----------messageComponentLayout (Region)
    -----------------MessageLovInpurt
    -----------------MessageChoice(Item)
    -----------------MessageTextInput
    -----------------MessageLayout
    ----------HideShow (Region)
    -----------------MessageLovInpurt(Item)
    -----------------MessageChoice(Item)
    -----------------MessageTextInput(Item)
    -----------MessageComponentLayout (Region)
    -----------------MessageLayout
    ------------------------SubmitButton(ID:SearchBtn)
    ------------------------SubmitButton(ID:ClearBtn, fires partial action named clear)
    -----------header(Region)
    I am not able to capture the event fired by the button ClearBtn in the controller of the pagelayout.....
    The two methods I used as follows aren't worked:
    if ("clear".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
    if (pageContext.getParameter("ClearBtn") != null) {
    what should i do in order to capture the button event in the pageLayout Controller
    Thanks in advance
    Mandy
    Edited by: user8898100 on 2011-8-2 上午7:49

    Mandy,
    Its really strange that its not able to caputure the event in CO.
    Below is the way in which we handle to Submit action at CO level.
    /Check whether ClearBtn is same in case too.
    if(pageContext.getParameter("ClearBtn")!=null){
    System.out.println("Inside the Clear Btn Action");
    Regards,
    Gyan

Maybe you are looking for

  • Using BC-XMW in mini ABAP engine 6.20

    Hello First of all I hope I'm in the right forum, if not I appologize, and hope some one points me to the right one. I installed the 6.20 test version and the GUI which seem to work OK. It is my intention to use CCMS via the BC-XMW interface. To use

  • Two or more sites on .mac file structure?

    Hello everyone, I need some advice before I screw up things again. Just did but I fixed it partially. I want to ftp 2 sites. first one is not a problem I upload the folder and the index file with transmit web/sites in the sites folder I now see _gall

  • Oracle Exp/Imp Utility

    If i do a full export from on database instance and import to a new instance, will that import the entire data and create tablespaces and users into to the instance?

  • Working off 3 junction tables...

    Greetings: My 3 dimensional skills are taxed with this query. I have 3 junction M2M tables- Bid to Code: junction_ID bid_ID cccode_ID Vendor to Code: ccjunction_ID cccategory_ID vendor_ID Vendor to bid (not used in this query) and one contact table,

  • Managing event type linkages

    Hi, folks! I need your experience for a moment. Could you tell me how could I know if a particular event type linkage of any business object type (say BUS2032) is activated or not in run-time, thru abap code? Hope it was clear enough. Thank you very