User Entered Key

I have used 'DES' to encrypt a file which is viewed through a java program.
If the user wants to read the file they must enter the key to access it it, this all works fine, however I have found that single characters can be changed in the encryption key and it will still be parsed as valid, I believe this is because of Parity bits in the encryption. What is the best way of forcing the user to enter the 'exact' key in order for a successfull match to be made?
Many Thanks,
Craig

The key is generated and the file encrypted using the following keygen, this is then presented to the user which he has to type in when he wants to open the file, is this incorrect?
// Create Key
KeyGenerator keyGen = KeyGenerator.getInstance("DES");
SecretKey key = keyGen.generateKey();
// Prepare Output file
ByteArrayOutputStream tempOut = new ByteArrayOutputStream();
exportXML(tempOut, cookieList);
ByteArrayInputStream tempIn = new ByteArrayInputStream(tempOut.toByteArray());
tempOut.close();
//initialise the cipher
Cipher.getInstance("DES").init(Cipher.ENCRYPT_MODE, key );
// create CipherOutputStream
CipherOutputStream costm = new CipherOutputStream(tempOut, Cipher.getInstance("DES"));
// encrypt data
byte[] b = new byte[8];
int i = istm.read(b);
while (i != -1)
costm.write(b, 0, i);
i = istm.read(b);
costm.close();
// Present key to user
String strRet = "";
if ( key != null )
strRet = toHexString( key.getEncoded() );
System.out.println(strRet);
     * Build a hexadecimal representation of the key
     private static String toHexString( byte[] block )
          StringBuffer buf = new StringBuffer();
          int len = block.length;
for (int i = 0; i < len; i++)
               byte2hex(block, buf);
return buf.toString();
     * Transform a byte into a 2 char hex representation
     private static void byte2hex( byte b, StringBuffer buf )
          char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C', 'D', 'E', 'F' };
int high = ((b & 0xf0) >> 4);
int low = (b & 0x0f);
buf.append(hexChars[high]);
buf.append(hexChars[low]);

Similar Messages

  • How can I prevent forms from being prematurely submitted when users click on the  "Enter" key?

    Is there any way that I can prevent Dreamweaver CF submission forms from being prematurely submitted by the user when he/she clicks on the "Enter" key before they have completed the form?  I need the users to finish form and click on the "Submit" key.  I have the "Submit" key action configured as "submit form"

    Thank you!
    Found a solution through Google.

  • How to prevent numericstepper from setting the value to the defined Maximum when a number greater than maximum is entered in by keyboard and user hits the "Enter" key.

    I need to set the Maximum so that the use can use the mouse to change the value of numericstepper (and not go over a certain number), but at the same time I have to allow the user to enter their value by typing in the text field. When the user enters a number greater than the Maximum, I disable the "Ok" button of the dialog and show a red warning(error message). The issue is that the user can hit "Enter" and numeric stepper would set the value to the Maximum and the dialog box would close and the rest of code would run. I want the numericstepper not to change the value and keep showing the warning even if the user hits the "Enter".
    Note: Setting maxChar does not help since my maximum is 1000, and user might enter 5555
    I would appreciate the help.

    Thanks for trying to help, But
    The issue is that if I set the maximum value of stepper 1 greater than the max value that I want, then the user can select an invalid value(of myMax + 1) when he clicks on the UP arrow of the numeric stepper(which is not acceptable for what I am working on).
    I need to preserve the users invalid number, while not letting the user to select an invalid number by clicking UP key.
    I noticed that when the user enters a number greater than the Maximum, and then click on the down arrow, it would set the value to 1 less than the maximum. This is not acceptable either.

  • Handling "enter" key while a user clicks a button being displayed in datagrid

    Hi,
    I have a datagrid of which one non editable column has an itemrenderer render a button while a row is hovered or selected. I am usinhg default tab handling of datagrid. I want to handle the button click event when a user presses enter key while the focus is on this tabbed column.
    Can anyone help me how to ahcieve this?

    This how my datagrid looks ..main file
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                public function myKeyDownEvent(event:Event):void{
                    mx.controls.Alert.show("Selected " + myGrid.columns[0].popupIndex);
            ]]>
        </fx:Script>
        <fx:Declarations>
            <fx:XMLList id="transactions">
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Match</type>
                    <date>11-23-2009</date>
                    <payee>SAVINGS debit 323</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Savings</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-24-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>0</payment>
                    <deposit>20</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-23-2009</date>
                    <payee>SAVINGS debit 327</payee>
                    <payment>0</payment>
                    <deposit>10</deposit>
                    <account>My Savings</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Match</type>
                    <date>11-23-2010</date>
                    <payee>SAVINGS debit 323</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Savings</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-24-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>0</payment>
                    <deposit>20</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-23-2010</date>
                    <payee>SAVINGS debit 327</payee>
                    <payment>0</payment>
                    <deposit>10</deposit>
                    <account>My Savings</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2010</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
                <transaction>
                    <type>Unassigned</type>
                    <date>11-21-2009</date>
                    <payee>CREDITCARD debit 328</payee>
                    <payment>10</payment>
                    <deposit>0</deposit>
                    <account>My Visa</account>               
                </transaction>
            </fx:XMLList>
        </fx:Declarations>
        <mx:DataGrid id="myGrid" width="100%" height="100%" dataProvider="{transactions}" editable="true" allowMultipleSelection="true" rollOverColor="0x9BDFFA"
                     selectionColor="0x004B8D" textSelectedColor="white">
            <mx:columns>
                <mx:DataGridColumn headerText="Type" dataField="type" itemRenderer="TypeItemRenderer" editable="false"/>
                <mx:DataGridColumn headerText="Date" dataField="date" />
                <mx:DataGridColumn headerText="Payee" dataField="payee" />
                <mx:DataGridColumn headerText="Envelope" dataField="envelope" editable="false" />
                <mx:DataGridColumn headerText="Payment" dataField="payment" />
                <mx:DataGridColumn headerText="Deposit" dataField="deposit" />
                <mx:DataGridColumn headerText="Account" dataField="account" editable="false"/>
            </mx:columns>
        </mx:DataGrid>
    </s:Application>

  • How to refresh changed data in a plannable template with the Enter Key

    Hi,
    The situation I face is as follows.
    Integrated Planning is being implemented as a tool for budgeting. The user changes a value in a plannable cell on the portal and wishes to see the new updated data by pressing ENTER. Currently we have provided a REFRESH button so that the user gets the desired result.
    Is it possible to see the updated value by pressing ' ENTER' and if so , whats the way around to do it.
    thanks in advance.
    Jaya

    Hey guys,
    I'm interested too in this solution. In BPS there is an additional function described in the HowTo Paper HowTo run planning functions on save and other events
    Now I'm looking for this possibility in IP as well in excel-based IP and web-based IP. For example a copy function should be executed automatically when pushing the enter key.
    Thanks a lot!
    Clemens

  • How can I read the last cell of a JTable that a user Enters data

    I have a one column JTable with several rows that a user enters data to. Upon entering the last data, the user clicks a button to read all the data from the rows in the JTable and puts them in an arraylist. If the user does not click enter or navigates away from the last cell, then after clicking the button it does not read the last cell entered. Since the user is clicking on a button to indicate he is done entering data on the table, does he also have to hit the enter key to indicate he is done entering the data?
    The code below is my tablemodelListener:
    public class InteractiveTableModelListener implements TableModelListener {
    public void tableChanged(TableModelEvent evt) {
    if (evt.getType() == TableModelEvent.UPDATE) {
    int row = evt.getFirstRow();
    System.out.println("Update row:"+" "+row);
    jTable1.setRowSelectionInterval(row, row);
    }

    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
    In the future, Swing related questions should be posted in the Swing fourm. (This question has been asked and answered dozens of times).
    But there is not need to repost because [Table Stop Editing|http://www.camick.com/java/blog.html?name=table-stop-editing] explains whats happening and give a couple of solutions.

  • Table Control[Accept Input Only] - "ENTER" Key

    Hi Folks,
    I'm reviving this unanswered thread in relation to table control: when the user press enter, all the values entered disappear.
    [url]Re: Table control (Enter key)[url]
    I have a table control that accepts "ONLY" input, meaning to say, there will be no pre-loading of data in the PBO, so it will loop through the table control itself instead of looping from an internal table.
    Issue: Whenever I press "ENTER" in any column/row of my table control, ALL the values I entered disappear.
    PBO:
    PROCESS BEFORE OUTPUT.
      MODULE CLEAR_OKCODE.
      MODULE LOAD_TABLECTRL.
      LOOP WITH CONTROL TC_DATA.
        MODULE READ_DATA.
      ENDLOOP.
    module READ_DATA output.
      READ TABLE T_DATA INTO WA_DATA INDEX TC_DATA-current_line.
      data : line_count type i.
      "to increase the number of lines in table control dynamically
      describe TABLE t_data lines line_count.
      TC_DATA-lines = line_count + 10.
    endmodule. 
    PAI:
    PROCESS AFTER INPUT.
      LOOP WITH CONTROL TC_DATA.
        MODULE MODIFY_DATA.
      ENDLOOP.
    module MODIFY_DATA input.
    WHEN 'CREATE'.
      "subroutines are here, etc.
    WHEN 'DELETE'.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
    endmodule.
    In my ABAP Debug, the value of SY-UCOMM is BLANK whenever I press Enter.
    Thanks.

    Hi
    Your code seems to be rght only the MODIFY statament is useless:
    module READ_DATA output.
      READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
      IF SY-SUBRC EQ 0.
        ZQID_CHECK-WERKS = WA_ID_CHECK-WERKS.
        ZQID_CHECK-MATNR = WA_ID_CHECK-MATNR.
        ZQID_CHECK-LICHA = WA_ID_CHECK-LICHA.
        ZQID_CHECK-LIFNR = WA_ID_CHECK-LIFNR.
      ELSE.
        CLEAR ZQID_CHECK.
      ENDIF.
    endmodule.
    Now before LOOP of PBO try to set the lines of table control to be display, I've created this report on my system and it works fine:
    .CONTROLS T_CTRL TYPE TABLEVIEW USING SCREEN 100.
    DATA: BEGIN OF ITAB OCCURS 0,
              WERKS LIKE MARC-WERKS,
              MATNR LIKE MARC-MATNR,
              LIFNR LIKE LFA1-LIFNR,
          END   OF ITAB.
    DATA: WA LIKE ITAB.
    START-OF-SELECTION.
      DO 4 TIMES.
        ITAB-WERKS = '5010'.
        ITAB-MATNR = '1234567890'.
        ITAB-LIFNR = '0000000001'.
        APPEND ITAB.
      ENDDO.
      CALL SCREEN 100.
    PROCESS BEFORE OUTPUT.
      MODULE SET_T_CTRL.
      LOOP WITH CONTROL T_CTRL.
        MODULE READ_DATA.
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP WITH CONTROL T_CTRL.
        MODULE MODIFY_DATA.
      ENDLOOP.
    MODULE SET_T_CTRL OUTPUT.
      DESCRIBE TABLE ITAB LINES T_CTRL-LINES.
    ENDMODULE.                 " SET_T_CTRL  OUTPUT 
    MODULE READ_DATA OUTPUT.
      READ TABLE ITAB INDEX T_CTRL-CURRENT_LINE.
      IF SY-SUBRC = 0.
        MOVE-CORRESPONDING ITAB TO WA.
      ELSE.
        CLEAR WA.
      ENDIF.
    ENDMODULE.                 " READ_DATA  OUTPUT
    MODULE MODIFY_DATA INPUT.
      MODIFY ITAB FROM WA INDEX T_CTRL-CURRENT_LINE.
      IF SY-SUBRC NE 0.
        CHECK NOT WA IS INITIAL.
        APPEND WA TO ITAB.
      ENDIF.
    ENDMODULE.                 " MODIFY_DATA  INPUT

  • Enter Key is not being accepted properly in the Applet

    We have developed a Telnet application which is in form of an Applet. We are facing some problems with respect to that.
    We are using Java 1.2.
    When login sessions are launched, the login prompt is displayed.
    After we enter the user id and press the "Enter" Key, the UI remains at the "user id" prompt and is not accepting the "Enter" Key.
    As a result, we are not getting the password prompt and hence NE UI is not deing displayed.
    This was verified with logs and found that the "Enter" key was interpreted as "char 7" instead of Ascii char 10(Enter Key).
    This problem was observed in both IE and Netscape.
    But this same code works fine when it is run as a Java application. Also the same applet works fine when viewed from the Applet Viewer.
    Iam of the view that the issue may be due to the restrictions imposed by the browsers on the Java Applet.
    Please give me suggestions to circumvent this problem ,if u have faced the same.
    Thanks in advance,
    Darshan

    The reason why ENTER doesn't work is because it's reserved for the default button. The SPACEBAR does what you want.
    http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/doc-files/Key-Metal.html#JButton
    To change the key mappings, read up on JComponent.getActionMap(), JComponent.setActionMap() and the ActionMap class.

  • Action for ENTER KEY is not working in alv grid output (Classical)

    Hi Experts,
      I have searched SDN around 8 hours and could not get any help on my below issue.
      I am developing ALV report using function module (Classical ALV). ALV output has 4 input enable fields, if user enters data in any of those fields and clicks on enter button from key pad..the remaining fields needs to be filled automatically.
      I am facing the issue with enter key, even if i press enter key in the output there is no action and hence no user command triggered. May be i am using wrong funcion code in wrong way.
      Could any one tell me what function code can we assign for ENTER action in PF-STATUS?
    Regards,
    Murali Mohan

    Hi
    Try this simple code, it works fine:
    TYPE-POOLS: SLIS.
    DATA: BEGIN OF ITAB1 OCCURS 0,
           BUKRS LIKE T001-BUKRS,
           BUTXT LIKE T001-BUTXT,
          END OF ITAB1.
    DATA: GT_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
          GT_REPID    LIKE SY-REPID.
    START-OF-SELECTION.
      SELECT BUKRS BUTXT INTO TABLE ITAB1
         FROM T001.
    END-OF-SELECTION.
      GT_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME     = GT_REPID
          I_INTERNAL_TABNAME = 'ITAB1'
          I_INCLNAME         = GT_REPID
        CHANGING
          CT_FIELDCAT        = GT_FIELDCAT.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = GT_REPID
          I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IT_FIELDCAT              = GT_FIELDCAT
        TABLES
          T_OUTTAB                 = ITAB1.
    FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                          RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'ENTER'. MESSAGE I208(00) WITH 'Pressed ENTER key'.
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    FORM SET_PF_STATUS  USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'LIST_ALV' EXCLUDING RT_EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    Max

  • Submitting a form with enter key causing strange problems

    I am having a very strange problem with a webapp I am currently developing. I am using JSF 1.2 along with Facelets and RichFaces. I have coded a workflow/wizard 4-step process, and on some pages I have 4 submit buttons that all call different actions on the page. The users thought it would be useful to have the enter key submit the form, so I followed some online resources to trap a keypress using javascript, looking for the enter keycode and calling document.getElementById("elementName").click(). This works fine most of the time. Sometimes, though, it seems as if an entire new session is being created, and odd behavior starts happening. For example, my page will only include 2 of the 4 facelets on the screen -or- I will get NullPointerExceptions for objects that I know have been created in the session bean I am currently using -or- I will get a duplicate form Id after trying to re-submit the page. Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"? I'm really at my wit's end here (plus it's nearly 3 AM, that never helps things). All of the buttons being clicked are standard h:commandButtons. There is some setTimeout logic included to disable the buttons on the page to prevent double clicks (I cannot disable them onsubmit because disabled buttons don't pass the right values, perhaps that's causing it, but if so, clicking the buttons with the mouse would cause that issue too, right?)
    I am not posting the code (yet), but if anyone wants to take a look see and see if I am doing something really abhorrently wrong, I'm more than willing to, I'm just curious if anyone has had problems regarding javascript submission of forms via the click() method. Clicking the button does not exhibit this type of behavior. Just as a side note: I am doing different things with the enter key depending if a modal window is open (the enter key closes the modal if it's up, and if not, it submits the form via a button click).
    Any help is much appreciated, if anyone has any inkling about where I should start looking for answers it would be really helpful.
    Thank you.

    edfrost wrote:
    Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"?My guess is the second of these. You need to suppress the event handling after programmatically clicking the button.

  • Text entry boxes in CP6 - Enter key to validate input does not work in Safari?

    I'm using Captivate 6 to create a step by step walkthrough of some different processes that are commonly completed in my workplace. Some of the example processes have portions where text is entered to simulate a process the end user might need.  I have text entry boxes in these slides that require validation of the input to move along, with Enter used as a shortcut key. This works great in Firefox, Chrome and IE all the way down to 8....but if the course is run in Safari, the enter key does nothing.  Is this a known issue?
    Additional info: For many of these text entry boxes, the point is that it is a search field that has a little binoculars icon next to it that executes the search in the actual software we are simulating. For these slides I actually have the submit button associated with the text box made invisible (no fill, no stroke) and placed on top of the binoculars icon. This is an acceptable method of doing the task we're demonstrating, and just so happens to be a workaround for the enter key not working in Safari. However, a few places we have text entry that doesn't have the search/binocular icon next to it because there is a different goal on that section of the software we're visualizing. In those cases, there is no place for me to put an invisible submit button, and I can't make the submit button visible because that's not how the software we're demonstrating would work (thus defeating the purpose of the training).

    Sorry, this is a known bug with no fix available yet, but the makers of SwiftKey are aware of it and we will work with them to fix it: https://bugzilla.mozilla.org/show_bug.cgi?id=617298
    For now, the only solution is to use a different keyboard when using Firefox.

  • I have updated to Mozilla 16.0.1 and yahoo toolbar 2.4.8.20120412011105. Search assist now no longer works on the toolbar. Enter key also will not work on toolb

    I have updated to Mozilla 16.0.1 and yahoo toolbar 2.4.8.20120412011105. Search assist now no longer works on the toolbar, nor does the enter key. I've reinstalled both Mozilla and the yahoo toolbar. I've followed the instructions given in the customize toolbar section, but I am thinking that perhaps this toolbar just doesn't work with Mozilla?

    '''Try the Firefox Safe Mode''' to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "'Start in Safe Mode"''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • User Table Key set up in User defined field management

    Dear  Expert,
    what is use of User Table Key set up in User defined field management in SAP B1.
    Thanks.
    Sridharan.R
    Edited by: Sridharan.R on Oct 4, 2011 8:26 AM

    Hi,
    Once a UDF is created and a value is entered in it, the same cannot be retrieved in any of the layouts and reports unless a Key is generated for that UDF. By assigning a Key to that UDF, the same UDF can be used in Crystal Reports or any other Reporting tool to extract its values from SAP. These reporting tools searches the Uniqueness of the UDF Values with this Keys only.
    For eg.: When you develop a report and select a table from which you need the fields to be shown in the layout. In that, the only fields whose keys are generated are only available to use in the report.
    Hope its clear to you.
    Regards,
    Papil

  • Af:inputListOfValues sets value of first item in result set when using enter key or tab and component set to autosubmit=true

    I'm using JDev 11.1.1.6 and when I type a value into an af:inputListOfValues component and hit either the enter key or the tab key it will replace the value I entered with the first item in the LOV result set. If enter a value and just click out of the af:inputListOfValues component it works correctly. If I use the popup and search for a value it works correctly as well. I have a programmatic view object which contains a single transient attribute (this is the view object which is used to create the list of value component from) and then I have another entity based view object which defines one of its attributes as a list of value attribute. I tried using an entity based view object to create the LOV from and everything works as expected so I'm not sure if this is a bug when using programmatic view objects or if I need more code in the VOImpl. Also, it seems that after the first time of the value being replaced by the first value in the result set that it will work correctly as well. Below are some of the important code snippets.
    Also, it looks like it only doesn't work if the text entered in the af:inputListOfValues component would only have a single match returned in the result set. For instance given the result set in the code: Brad, Adam, Aaron, Fred, Charles, Charlie, Jimmy
    If we enter Cha, the component works as expected
    If we enter A, the component works as expected
    If we enter Jimmy, the component does not work as expected and returns the first value of the result set ie. Brad
    If we enter Fred, the component does not work as expected and returns the first value of the result set ie. Brad
    I also verified that I get the same behavior in JDev 11.1.1.7
    UsersVOImpl (Programmatic View Object with 1 transient attribute)
    import java.sql.ResultSet;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import oracle.adf.share.logging.ADFLogger;
    import oracle.jbo.JboException;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    // ---    File generated by Oracle ADF Business Components Design Time.
    // ---    Wed Sep 18 15:59:44 CDT 2013
    // ---    Custom code may be added to this class.
    // ---    Warning: Do not modify method signatures of generated methods.
    public class UsersVOImpl extends ViewObjectImpl {
        private static ADFLogger LOGGER = ADFLogger.createADFLogger(UsersVOImpl.class);
        private long hitCount = 0;
         * This is the default constructor (do not remove).
        public UsersVOImpl () {
         * executeQueryForCollection - overridden for custom java data source support.
        protected void executeQueryForCollection (Object qc, Object[] params, int noUserParams) {
             List<String> usersList = new ArrayList<String>();
             usersList.add("Brad");
             usersList.add("Adam");
             usersList.add("Aaron");
             usersList.add("Fred");
             usersList.add("Charles");
             usersList.add("Charlie");
             usersList.add("Jimmy");
             Iterator usersIterator = usersList.iterator();
             setUserDataForCollection(qc, usersIterator);
             hitCount = usersList.size();
             super.executeQueryForCollection(qc, params, noUserParams);
        } // end executeQueryForCollection
         * hasNextForCollection - overridden for custom java data source support.
        protected boolean hasNextForCollection (Object qc) {
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             if (usersListIterator.hasNext()) {
                 return true;
             } else {
                 setFetchCompleteForCollection(qc, true);
                 return false;
             } // end if
        } // end hasNextForCollection
         * createRowFromResultSet - overridden for custom java data source support.
        protected ViewRowImpl createRowFromResultSet (Object qc, ResultSet resultSet) {
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             String user = (String)usersListIterator.next();
             ViewRowImpl viewRowImpl = createNewRowForCollection(qc);
             try {
                 populateAttributeForRow(viewRowImpl, 0, user.toString());
             } catch (Exception e) {
                 LOGGER.severe("Error Initializing Data", e);
                 throw new JboException(e);
             } // end try/catch
             return viewRowImpl;
        } // end createRowFromResultSet
         * getQueryHitCount - overridden for custom java data source support.
        public long getQueryHitCount (ViewRowSetImpl viewRowSet) {
             return hitCount;
        } // end getQueryHitCount
        @Override
        protected void create () {
             getViewDef().setQuery(null);
             getViewDef().setSelectClause(null);
             setQuery(null);
        } // end create
        @Override
        protected void releaseUserDataForCollection (Object qc, Object rs) {
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             usersListIterator = null;
             super.releaseUserDataForCollection(qc, rs);
        } // end releaseUserDataForCollection
    } // end class
    <af:inputListOfValues id="userName" popupTitle="Search and Select: #{bindings.UserName.hints.label}" value="#{bindings.UserName.inputValue}"
                                                  label="#{bindings.UserName.hints.label}" model="#{bindings.UserName.listOfValuesModel}" required="#{bindings.UserName.hints.mandatory}"
                                                  columns="#{bindings.UserName.hints.displayWidth}" shortDesc="#{bindings.UserName.hints.tooltip}" autoSubmit="true"
                                                  searchDesc="#{bindings.UserName.hints.tooltip}"                                          
                                                  simple="true">
                              <f:validator binding="#{bindings.UserName.validator}"/>                      
    </af:inputListOfValues>

    I have found a solution to this issue. It seems that when using a programmatic view object which has a transient attribute as its primary key you need to override more methods in the ViewObjectImpl so that it knows how to locate the row related to the primary key when the view object records aren't in the cache. This is why it would work correctly sometimes but not all the time. Below are the additional methods you need to override. The logic you use in retrieveByKey would be on a view object by view object basis and would be different if you had a primary key which consisted of more than one attribute.
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, Key key, int i) {
        return retrieveByKey(viewRowSetImpl, null, key, i, false);
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, String string, Key key, int i, boolean b) {
        RowSetIterator usersRowSetIterator = this.createRowSet(null);
        Row[] userRows = usersRowSetIterator.getFilteredRows("UserId", key.getAttribute(this.getAttributeIndexOf("UserId")));
        usersRowSetIterator.closeRowSetIterator();
        return userRows;
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, Key key, int i, boolean b) {
        return retrieveByKey(viewRowSetImpl, null, key, i, b);

  • Problem with Enter key and JOptionPane in 1.4

    Hi,
    I had a problem with an application I was working on.
    In this application, pressing [Enter] anywhere within the focused window would submit the information entered into the form that was contained within the frame.
    The application would then try to validate the data. If it was found to be invalid, it would pop up a JOptionPane informing the user of that fact.
    By default, pressing [Enter] when a JOptionPane is up will activate the focused button (in most cases, the [OK] button) thus dismissing the dialog.
    In JDK 1.3 this worked fine. But in JDK 1.4, this has the result of dismissing the dialog and opping it up again. This is because the [Enter] key still works on the frame behind the JOptionPane and thus tries to validate it again, which results in another invalid dialog msg popping up.
    The only way to get out is to use the mouse or the Esc key.
    Now, in the application I put in a workaround that I was not very happy with. So, to make sure it wasn't the application itself, I created a test which demonstrates that it still misbehaves.
    Here it is.
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.WindowConstants;
    * @author avromf
    public class FocusProblemTest extends AbstractAction
         private static JFrame frame;
         public FocusProblemTest()
              super();
              putValue(NAME, "Test");
         public void actionPerformed(ActionEvent e)
              JOptionPane.showMessageDialog(frame, "This is a test.");
         public static void main(String[] args)
              FocusProblemTest action= new FocusProblemTest();
              try
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch (Exception e)
                   e.printStackTrace();
              frame= new JFrame("Test");
              frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              Container contents= frame.getContentPane();
              contents.setLayout(new FlowLayout());
              JTextField field= new JTextField("Test");
              field.setColumns(30);
              JButton  button= new JButton(action);
              KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true);
              button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(enterKey, "test");
              button.getActionMap().put("test", action);
              contents.add(field);
              contents.add(button);
              frame.pack();
              frame.setVisible(true);
    }Does anyone have any solution to this problem?

    I know that focus management has changed alot.
    Based on my experimentation a while back, in 1.4 it still believes that the JFrame is the window in focus, even though a JOptionPane is currently in front of it (unless I misinterpreted what was going on). Thus, the frame seems to get the keyboard event and re-invoke the action.
    A.F.

Maybe you are looking for

  • How to delete all items in the HUB ?

    How to delete all items on shot in the HUB ?

  • How i can do to get my password bac up

    how i can get my back up password

  • Best way to upload to Flickr??

    I want to upload photos to Flickr, but the directory of photos is like some unknown maze of data files, thumbnails, folders, etc. About the only thing I dont see are the titles of my photos and the photos themselves!!! So first of all, what's the bes

  • BOM explosion number field

    Hello Gurus, Is there any field for BOM explosion number in production order header data too?One field is in assignment tab in CO02 but I guess it is at item level. I dont find this field at header level but perhaps it is hidden. Do you see it? cheer

  • Conditional format of one cell based on contents of another cell

    Preparing list of appointments for visitors with time for each. There are four possible status categories for visitors based on projected activity and whether they have shown up or not. (A Group Scheduled, A Group Showed, B Group Scheduled, B Group S