2 actions on the same form ?

Hi everyone,
I hope someone can give me an idea on how to do the following.
I have a form where the user has a choice of 2 buttons.
[Update details] , [Delete record]
If the [Update details] is clicked the form action should direct to a different target to [Delete record]
How would one do that ?...
Also, is it possible to set a session variable in the "onClick" of each Submit to achieve that ?
If so, please let me have the syntax.
Thank you.

one option...
in your form...
<input type=submit name=MyRequest value=Delete>
<input type=submit name=MyRequest value=Update>
on some other page..
if(request.getParameter("MyRequest").trim().equals("Delete")){
   //Do Stuff
}else if(request.getParameter("MyRequest").trim().equals("Update")){
   //Do Other Stuff
} else {
   //error
}Is this what you mean?

Similar Messages

  • Upload image to directory and data to database from the same form

    Hello all
    I'm playing at building a shopping cart (never done one
    before) from a tutorial by Gordon Knapp at www.webthang.com.
    I have created the site and it works perfectly. Now I want to
    extend it.
    There is a form that allows the user to add data to the
    database. I would also like to be able to upload an image to a
    directory on the server and add the data to the database at the
    same time from the same form. It would be good if the input field
    "<input name="product_picture" type="text" id="product_picture"
    tabindex="6" size="50" />" could be populated automatically by
    the filename of the image being uploaded, but this isn't a
    neccessity.
    I have looked at various ASP Upload packages and I can upload
    an image alone but none of them make it clear how to upload the
    image and add data to the database at the same time.
    As this is a private project I need any suggestions to by
    free.
    The tutorial shows how to create the site in Ultra Dev but
    worked perfectly well in DW. The page concerned looks like this. It
    is named 'admin_add.asp':
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!--#include file="../Connections/con_ecom.asp" -->
    <%
    Dim MM_editAction
    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" &
    Server.HTMLEncode(Request.QueryString)
    End If
    ' boolean to abort record edit
    Dim MM_abortEdit
    MM_abortEdit = false
    %>
    <%
    ' IIf implementation
    Function MM_IIf(condition, ifTrue, ifFalse)
    If condition = "" Then
    MM_IIf = ifFalse
    Else
    MM_IIf = ifTrue
    End If
    End Function
    %>
    <%
    If (CStr(Request("MM_insert")) = "add_form") Then
    If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_con_ecom_STRING
    MM_editCmd.CommandText = "INSERT INTO products
    (product_category, product_name, product_price, product_briefdesc,
    product_fulldesc, product_picture) VALUES (?, ?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202, 1, 50,
    Request.Form("product_category")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202, 1, 50,
    Request.Form("product_name")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 5, 1, -1,
    MM_IIF(Request.Form("product_price"),
    Request.Form("product_price"), null)) ' adDouble
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 203, 1, 536870910,
    Request.Form("product_briefdesc")) ' adLongVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 203, 1, 536870910,
    Request.Form("product_fulldesc")) ' adLongVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 202, 1, 50,
    Request.Form("product_picture")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "admin_control.asp"
    If (Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0)
    Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" &
    Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" &
    Request.QueryString
    End If
    End If
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Administration - Add Product</title>
    <link href="../scripts/admin.css" rel="stylesheet"
    type="text/css" />
    <script type="text/javascript"
    src="../scripts/ecom.js"></script>
    </head>
    <body onLoad="adminTitle()">
    <div id="wrapper">
    <div id="pageHeading">ADMINISTRATION - ADD
    PRODUCT</div>
    <div id="navBar"><a
    href="admin_control.asp">Control</a> | Add | <a
    href="admin_view.asp">View</a> | <a
    href="admin_update1.asp">Update</a> | <a
    href="admin_delete1.asp">Delete</a> | <a
    href="../Default.asp">Shop</a></div>
    <br />
    <form name="add_form" id="add_form" method="POST"
    action="<%=MM_editAction%>">
    <table border="1" align="center" id="tblArea">
    <tr>
    <td class="tdLabel">Product Category</td>
    <td colspan="2"><input name="product_category"
    type="text" id="product_category" tabindex="1" size="50"
    /></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Name</td>
    <td colspan="2"><input name="product_name"
    type="text" id="product_name" tabindex="2" size="50"
    /></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Price</td>
    <td class="tdContent" colspan="2"><input
    type="text" name="product_price" id="product_price" tabindex="3"
    size="50" /></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Short
    Desciption</td>
    <td class="tdContent" colspan="2"><textarea
    name="product_briefdesc" id="product_briefdesc" cols="47" rows="4"
    tabindex="4"></textarea></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Full
    Description</td>
    <td class="tdContent" colspan="2"><textarea
    name="product_fulldesc" id="product_fulldesc" cols="47" rows="5"
    tabindex="5"></textarea></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Image File Name</td>
    <td class="tdContent" colspan="2"><input
    name="product_picture" type="text" id="product_picture"
    tabindex="6" size="50" /></td>
    </tr>
    <tr>
    <td class="tdLabel"> </td>
    <td align="center"><input type="reset" name="Reset"
    id="Reset" value="Reset Form" /></td>
    <td align="center"><input type="submit"
    name="Submit" id="Submit" value="Add To Shop" /></td>
    </tr>
    </table>
    <input type="hidden" name="MM_insert" value="add_form"
    />
    </form>
    </div>
    </body>
    </html>
    Hope you can help.
    Warm regards
    Martin

    Got it sorted.
    Found an excellent tutorial at Webthang.
    http://www.webthang.co.uk/tuts/tuts_dmx/rob15/rob15.asp

  • How can I have both functions "Read Only" & "Write" mode on the same form?

    Dear all,
    How can I have both functions "Read Only" & "Write" mode on the same form? Is it possibile for this?
    Please advice,
    Amy

    This is what I use in some dialogs:
    PROCEDURE SET_QUERY_ONLY IS
      -- Procedure Set_query_only
      -- Rend les blocks non modifiables   --
      -- Disable menus Insert/Delete/Clear --
      -- Entree               :
      -- Sortie               :
      -- Ent/Sortie     :
      -- Creation               : FD    10/2003
      -- Modification     : 
         LC$Block     Varchar2(30) ;
    BEGIN
      Set_Menu_Item_Property('Edit.Insert', ENABLED, PROPERTY_FALSE ) ;
      Set_Menu_Item_Property('Edit.Remove', ENABLED, PROPERTY_FALSE ) ;
      Set_Menu_Item_Property('Edit.Clear', ENABLED, PROPERTY_FALSE ) ;
      Set_Menu_Item_Property('Action.Save', ENABLED, PROPERTY_FALSE ) ;
      LC$Block := get_form_property( NAME_IN('System.Current_Form'), FIRST_BLOCK ) ;
      -- Tous les blocs en Query only --
      While LC$Block is not null Loop
           Enable_Block( LC$Block, FALSE ) ;
           LC$Block := get_block_property( LC$Block, NEXTBLOCK ) ;
      End loop ;
    END;
    PROCEDURE ENABLE_BLOCK
              PC$Block in Varchar2,
              PB$Enable in Boolean Default TRUE
         ) IS
      -- Procedure Enable_block
      -- Rend le bloc Enable / Disable --
      -- Entree          : PC$Block (nom du bloc Forms)
      --               : PB$Enable (TRUE ou FALSE)
      -- Sortie          :
      -- Ent/Sortie             :
      -- Creation          : FD    10/2003
      -- Modification     : 
    BEGIN
         If PB$Enable Then
              Set_Block_Property( PC$Block, INSERT_ALLOWED, PROPERTY_TRUE ) ;
              Set_Block_Property( PC$Block, UPDATE_ALLOWED, PROPERTY_TRUE ) ;
              Set_Block_Property( PC$Block, DELETE_ALLOWED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Edit.Insert', ENABLED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Edit.Remove', ENABLED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Edit.Clear', ENABLED, PROPERTY_TRUE ) ;
              Set_Menu_Item_Property('Action.Save', ENABLED, PROPERTY_TRUE ) ;
         Else
              Set_Block_Property( PC$Block, INSERT_ALLOWED, PROPERTY_FALSE ) ;
              Set_Block_Property( PC$Block, UPDATE_ALLOWED, PROPERTY_FALSE ) ;
              Set_Block_Property( PC$Block, DELETE_ALLOWED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Edit.Insert', ENABLED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Edit.Remove', ENABLED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Edit.Clear', ENABLED, PROPERTY_FALSE ) ;
              Set_Menu_Item_Property('Action.Save', ENABLED, PROPERTY_FALSE ) ;
         End if ;
    END;Francois

  • Problem !! How to upload an file and get parameters on the same form ?

    Hello!
    Is there anyway of getting parameters from an
    text field input in a form like :
    <form name="signinForm" method="post" action="uploadFile.jsp" enctype="multipart/form-data" >Actually I would like to insert the parameters and make the upload of an file
    on the same form. It is something likethis :
    Form.jsp
    <form name="signinForm" method="post" action="uploadFile.jsp" enctype="multipart/form-data" >   
    <input type="text" id="name" name="signinName" />
    <input name="signinFile" id="fileUp" type="file" />   
    <input type="submit" id="submit_btn" name="signinSubmit"/>uploadingFile.jsp
    <%@ page import="java.io.*,javax.servlet.http.HttpServletRequest,javax.servlet.ServletInputStream" %>
    <%@ page import="java.io.FileWriter,java.io.IOException" %>
    <%
    .//upload the file
    String email = request.getParameter("signinName").trim(); //this line is bringing me an NullPointerException
    %>Thanks in advance for any suggestion!!
    All the best!

    You can get the parameter value directly. You can do the following to get the parameter name.
    Directly take the request's input stream and parse the header and findout the value for text field.
    Or you can use apache's file upload utilities and do the following
    DiskFileItemFactory factory = new DiskFileItemFactory();
                   ServletFileUpload upload = new ServletFileUpload(factory);
                   List fileItems = upload.parseRequest(request);
                   Iterator iter = fileItems.iterator();
                   while (iter.hasNext()) {
                        FileItem item = (FileItem) iter.next();
                        if (item.isFormField()) {
         //Form data fields will be displayed here          out.println(item.getFieldName());
         out.println(item.getString());
    All the best..

  • How can multiple users manage the same forms?

    We are looking to purchase FormsCenral however after read this FAQ on teams we are confused:
    http://forums.adobe.com/docs/DOC-2903#Q3
    How do we manage forms if more than one user needs to make changes to the same forms?

    You would have a primary user/e-mail address attached to your FormsCentral account, and you can assign multiple co-authors to any of your forms. They would need to each have a free Adobe ID.
    I work in a Higher Education setting, and have co-workers and Graduate Assistants who are co-authors on forms I've produced, so they can each edit and/or view the submitted response tables.
    I hope that helps,
    Brian

  • Prevent multiple users accessing the same form

    hi,
    i am working in forms
    i have a requirement like this
    if more than one user are using the same form and try to access the same record then the second user should not be able to do transaction
    he should be popped up with a msg saying that other user is working on it
    can any one suggest how to do this in my form
    thanks in advance
    selvaraj s

    That is pretty much exactly the way Forms works automatically.
    Two users can use the same form, and can even display the same data record. One of the users can make changes to the record -- Forms locks the row upon the FIRST keystroke in the first field the user begins to change.
    Once the row is locked, the second user is free to look at the record, and won't even know if another user has begun making changes. However, if second user tries to change even one field in the record, Forms pops up the message, "Could not reserve record (2 tries). Keep trying? Yes / No"
    There are also protections so if the first user actually changes the row and commits, then the second user tries to make a change. Forms will automatically detect whether changes were made, and if so, will undo the change and issue the message, "FRM-40654: Record has been updated by another user. Re-query to see change."
    The above automatic processing works very nicely. If it will not work for you, then what is it you need?

  • Open new window in the same form

    Hi
    I created a form with 6 records displayed. I have a check box for each record. I would like to select a record and make the check box checked. Once I check a checkbox I would like to automatically open a new window in the same form with further details of the checked record. Could you please help me how I could work on this.

    Dear you have to create relation between the blocks then you can achieve this like:
    1) Create two canvases in your form (canvas1 and canvas2).
    2) Create a window in your form with name Window2 now you have two windows (Window1 and Window2).
    3) now set the property 'Primary Canvas' of each window (Window1 = Canvas1, window2 = Canvas2)
    4) Now create database block of you main table with (CAT, NAME, DEPT) fields and select the Canvas1 in the layout wizard.
    5) Create another database block with same table but this time select only 3 fields (CAT,SAL, DATE) and at the time of creation mention relation between blocks in the Data block wizard (block1.cat = block2.cat) and select the Canvas2 in the layout wizard.
    6) Now create check box field name MASTER_CHBOX in first block and set Database Item property no of this check box item and set the Value When Checked property to Y and N for Value When unChecked.
    7) Create a trigger on CheckBox Item and paste below code in it.
    if :MASTER_CHBOX = 'Y' then
    show_window('WINDOW2');
    go_item('SAL');
    end if;
    Regards.
    Omer

  • How to apply different keyboard shortcuts to an actions with the same name but in different menus within one application?

    Hi,
    Hopefully someone can help. I have the application "djay" and in two different menus there is the action "Eject". I was wondering if it's possible to apply different keyboard shortcuts to those actions with the same name? I can't see how to do it as it seems you can only write the action but as there are two it doesn't seem to work for me.
    For example:
    djay>Table-1>Eject - ⌘⇧1
    djay>Table-2>Eject - ⌘⇧0
    Thanks in advance for any help!!

    A NodeList doesn't only contain 1 element. In your example it contains ALL <Data> elements inside the document.
    NodeList nodes = document.getElementsByTagName("Data");
    System.out.println(nodes.getLength() + " \"Data\"-elements found");
    for(int i=0; i<nodes.getLength(); i++) {
       Node node = nodes.item(i);
    }

  • Prevent multiple users from editing/approving the same form SPD 2013,SP 2013

    Hello all, I have a workflow with a to do task, the task is assigned to a group so any of the users in that group can go in and do a quality check on form data and approve it.  How do I prevent multiple users from working on the
    same form? do I just require check out? or is there a way to notify the rest of the group that a user has already started the quality check.

    The "Require Checkout" option is your best bet.  You can also enable the auto checkout on edit option to allow minimal effort on the side of the user.  Other users will then get the error message stating the item is checked out, if they try to
    edit it.
    If you'd like, you could add a workflow to the task list that triggers when something is changed.  That workflow can check if the item is checked out and if so, email the other users assigned to the task.
    I trust that answers your question...
    Thanks
    C
    |
    RSS |
    http://crayveon.com/blog |
    SharePoint Scripts | Twitter |
    Google+ | LinkedIn |
    Facebook | Quix Utilities for SharePoint

  • Simultaneously Connecting Multiple Tables of the same Database to Textboxes of the same Form using a single ADO Control Code using VB6 Enterprise Edition and MS Access 2007

    Iv 10 Tables consisting of atleast 10 fields each in a single Database. Bt, Im only able to connect 1 table at a time to a form using an ADO Control. Im able to add data from table 'student' to text-boxes in my form. Bt, hw can I add data from field(0) of
    Table 'Student' to Textbox1 and data from field(0) of Table 'Marks' to Textbox2 using VB6??
    This is the current sample coding iv got to connect a single table to a form:
    Global con As New ADODB.Connection
    Global rs As New ADODB.Recordset
    Public Function Connect()
    If con.State = 1 Then con.Close
    con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\bca.mdb;Persist Security Info=False"
    End Function
    Private Sub Add_Click()
    If rs.State = 1 Then rs.Close
    rs.Open "select * from student", con, adOpenDynamic, adLockOptimistic
    rs.AddNew
    rs.Fields(0) = (Text1.Text)
    rs.Fields(1) = (Text2.Text)
    rs.Fields(2) = (Text13.Text)
    rs.Fields(3) = (Text4.Text)
    rs.Fields(4) = (Text5.Text)
    rs.Fields(5) = (Text6.Text)
    rs.Fields(6) = (Text7.Text)
    rs.Fields(7) = (Text8.Text)
    rs.Fields(8) = (Text9.Text)
    rs.Fields(9) = (Text10.Text)
    rs.Fields(10) = (Text11.Text)
    rs.Update
    MsgBox " Record Added"
    End Sub
    What can I do to add fields from 2 different tables to different text boxes within the same form using a single ado control using vb6 and MS Access 2007??

    Hi,
    Since VB6 product is not supported in this forum, you may go to these forums for support:
    #Where to post your VB 6 questions
    http://social.msdn.microsoft.com/Forums/en-US/6a0719fe-14af-47f7-9f51-a8ea2b9c8d6b/where-to-post-your-vb-6-questions
    Thank you for your understanding.
    Best regards,
    Franklin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Opening  the same form more then one time in the same session

    H! I want to accomplish the following .... I have a form that has a button. The code in the when-buttin-pressed trigger is a call_form - to open another form. I want to be able to push this button as many times as the user may want and the form should keep opening a new form. Meaning I can have 10 forms of the second form open if I want. The user basically wants to be able to flip between the data on the same form opening up this form a couple of times in different windows. when I use the call form the button on the initial form is becoming disabled - not allowing me to push it again to open another form without closing the one already open. Please HELP!

    Sounds like you need Run_product rather than Call_form.
    It will establish multiple database sessions, and the user will be responsible for terminating them. And I am not sure, but this may only be possible in client/server forms.

  • Running multiple batch actions on the same folder? One Click?

    We run Actions on a group of images using CS4 with the File->Automate->Batch function. We use this to take, for example, 200 images from a set folder and run an "Action" to create a rendered 2D design and save it in a different location to the source image and add an extension to the file name, leaving the source image unaltered. 
    The problem is that we then require to run this 20 times, each time, the difference is :- we want it to save to a different location and the "action" used is different because it changes the colour for example.
    The desired output is:
    FROM A JPEG ---> 20 folders (named as 20 different colours) and all our images rendered (as in our action) and saved into the 20 folders
    So we have 20 versions of each image
    Currently we simply set off the different actions in a batch separately, IE. 20 lots of batches to set off.
    So for example:
    * We have 200 jpeg images in folder [A]
    * We run a Batch function to run an "action" on all 200 images in folder [A] to render into our design and add a blue colour overlay (this is all done in the action itself) and to save them to folder [B] with the extension (BLUE) added to the filename.
    * Once Photoshop finishes running this Action on the 200 images (wish it would beep or something to let you know it was finished) we then run a batch to run a different "action" on the same 200 images in folder [A] to render the design and add a pink overlay and to save them in folder [C] with the extension (PINK) added to the filename
    And so on and so forth for the 20 different actions.
    Is there a way we can instruct Photoshop to run all of these 20 actions (one after the other in a queue as it where) without having to "Babysit" Photoshop and ask it to run each one off ourselves manually?
    Would we have to use JavaScript for this? We have no experience with JavaScript at all.
    We are currently using Photoshop CS4, is there a easier way to do this on CS5 or CS6?
    Kind Regards and Thanks in advance
    Steven

    Would we have to use JavaScript for this?
    I think it would be advisable but (if you don’t mind risking getting less help) you could use VB or AppleScript depending on your platform.

  • How to insert a UUID into multiple tables in the same form

    I am trying to insert a UUID into 2 different tables at the
    same time ie to let this be created in the form and then insert
    this ID into 2 linked tables in a database using Access.
    Does anybody have any suggestions on how to accomplish this?
    Thanks very much

    So you have one form that processes information for two
    tables, or do you
    have two forms (one for each table - except the UUID)?
    If it is one form just run two SQL insert statements. One for
    the primary
    table, then one for the related table.
    If it is two forms run the above two SQL statements then an
    update statement
    to finish filling the second table.
    Or am I completely misunderstanding the issue?
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.adobe.com/communities/experts/
    "weelco" <[email protected]> wrote in
    message
    news:esjtjj$qtc$[email protected]..
    > Thanks for your quick reply, and yes I do know how to do
    that however I
    > would
    > like to do this all in one form field so I would like to
    create the UUID
    > whith
    > the same form that also submits it to another table, is
    this possible or
    > do I
    > have to do that using multiple 'pages'?
    >

  • MouseEvents and KeyEvents in the same form is not working

    Hello!
    I'm newbee in java althought i've bee programing for a long time in other languages, C, C++ wich i'm proud of.
    Now i land on java and there are a lot of cuestions (nothing that cant be solved by trying and reading).
    But today i hitted my head against all posible solutions and nothing (but bad mood) came out.
    The code with trouble is this...
    public class NewJFrame extends javax.swing.JFrame
        public NewJFrame()
            initComponents();
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    formKeyPressed(evt);
                public void keyReleased(java.awt.event.KeyEvent evt) {
                    formKeyReleased(evt);
                public void keyTyped(java.awt.event.KeyEvent evt) {
                    formKeyTyped(evt);
            jButton1.setText("jButton1");
            jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jButton1MouseClicked(evt);
            pack();
        private void formKeyTyped(java.awt.event.KeyEvent evt) {
            Integer i = evt.getKeyCode();
        private void formKeyPressed(java.awt.event.KeyEvent evt) {
            Integer i = evt.getKeyCode();
        private void formKeyReleased(java.awt.event.KeyEvent evt) {
            Integer i = evt.getKeyCode();
        private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
            Integer i = evt.getButton();
        private javax.swing.JButton jButton1;
    }In debug mode i cant listen to mouse events and key events in the same form. Is that normal ?
    In case this is normal, how can i surround this "problem" and make it work.
    Thanks a lot in ahead.

    Thanks for trying to understand whats going on ...
    There is my SSCCE
    * NewJFrame.java
    * Created on 2 de mayo de 2008, 20:32
    * @author  edu
    public class NewJFrame extends javax.swing.JFrame
        public NewJFrame()
            initComponents();
            setFocusable(true);
            requestFocus();
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    formKeyPressed(evt);
                public void keyReleased(java.awt.event.KeyEvent evt) {
                    formKeyReleased(evt);
                public void keyTyped(java.awt.event.KeyEvent evt) {
                    formKeyTyped(evt);
            jButton1.setText("jButton1");
            jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jButton1MouseClicked(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 400, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton1)
                        .addGap(0, 0, Short.MAX_VALUE)))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton1)
                        .addGap(0, 0, Short.MAX_VALUE)))
            pack();
        private void formKeyTyped(java.awt.event.KeyEvent evt) {                             
            setTitle(String.valueOf(evt.getKeyCode()));
        private void formKeyPressed(java.awt.event.KeyEvent evt) {                               
            setTitle(String.valueOf(evt.getKeyCode()));
        private void formKeyReleased(java.awt.event.KeyEvent evt) {                                
            setTitle(String.valueOf(evt.getKeyCode()));
        private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
            setTitle(String.valueOf(evt.getButton()));
        private javax.swing.JButton jButton1;
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NewJFrame().setVisible(true);
    }It's quite simple, its suposed to show on the windows title the KeyCode (if there is any) or the MouseButton when pressed.
    The problem is: it doesnt work... (if i comment out the jButton1 related code, that means that i dont listen to MouseEvents & dont add the MouseAdapter as MouseListner to the form, the KeyEvents are raised and i can listen to them - but there are no MouseEvents - if i run the SSCCE like above i can listen to the MouseEvents, but cant listen to the KeyEvents. Can you tell me why?
    Just before posting i realized it was a focus issue ! The button got the focus and got all the events redirected towards him ! I solved it with the code
            jButton1.setFocusable(false);and it finally worked !
    Thanks!

  • Use the same form with different button turned on in different calls

    Can I use the same form with different buttons turned on in different calls?
    Thanks!

    This is to avoid piracy. What could happen is, people could buy music, and give it away for free online. Usually it is then you buy a complete album off iTunes that it will only be available on one device. It is tied to that account, and the device must be registered to that account to listen to it.

Maybe you are looking for

  • How to setup resources in a WS project to be loaded from classpath?

    When I came in here to write this note, I saw the recent note titled "Placement of resources in WS project and runtime access", which is very similar to what I needed to know, but it isn't quite the same thing. I'm trying to put together a WebLogic W

  • How can you tell what version of Secutity update is installed.

    I have osx 10.8.5. Software update says I have security update 2014-001 1.0 available for my Mac. When I try to install, it downloads, says to restart, which I do, and then gives me an error message saying the update can't be installed and to contact

  • Junk Characters in file

    Hi Experts, I am using  GUI_DOWNLOAD to download a file on my local server, In debugging the file seems to be having perfect data but once the file gets downloaded it shows certain junk characters in the file.

  • Maintenance of multiple Valuation Categories for a Material

    Hi All, Presently we are using split Valuation Category H(Origin) & Valuation Types Domestic & Imported.We need to keep track of materials that are serviced externally with status for material(Refurbished & Repairable) for same material so that we ca

  • Adobe Reader will not run with limited user account.

    I am trying to upgrade our Citrix Server Farm, from Reader 8.0 to 9.1, and am running into some issues.  First I uninstalled Adobe Reader 8.0 and then installed 9.1 from Adobe's site. Aftter the install completed I was able to run 9.1 without any pro