3 Replies Latest reply: Nov 19, 2012 7:29 AM by Jitendra RSS

    onfocus event

    user12957777
      Please give example of how to write onfocus event in Manual Tabular Form for textfield item.

      Sanjay
        • 1. Re: onfocus event
          user12957777
          I tried the example given by Denes Kubicek in his Demo application: Page No.9
          
          Application Process: 
          
          DECLARE
             v_date   VARCHAR2 (20);
          BEGIN
             v_date := TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS');
             HTP.p (v_date);
          END;
          
          
          Javascript function
          <script>
          function f_setCurrentDate ()
          { 
            var get = new htmldb_Get(null,156,'APPLICATION_PROCESS=setCurrentDate',0);
            gReturn = get.get();
            html_GetElement('APEX_APPLICATION.g_f05').value = gReturn  
            get = null; 
          }
          </script>
          
          Please check if the javascript function is correct or not?
          Sanjay
          • 2. Re: onfocus event
            603257
            That is just the javascript which calls a function "setCurrentDate" through ajax. - you need to add a call to that javascript from the element itself.
            When you say manually created, how exactly do you mean? Post the SQL code that you're using to generate the table.
            • 3. Re: onfocus event
              Jitendra
              Hi user12957777 ,

              Please give your sql how you have created your tabular form.

              If you used APEX_ITEM.TEXT for the creation of text field then refer the below sample to use events.
              change the required values according to your requiement..like p_idx, p_value, p_attributes etc.

              use p_attributes for events.
              APEX_ITEM.TEXT(
                      p_idx                       =>    5,
                      p_value                     =>    c005,
                      p_size                      =>    10,
                      p_maxlength                 =>    2000,
                      p_attributes                =>    'onfocus="f_eval_attendance(parseInt(#ROWNUM#));"',
                      p_item_id                   =>    'f05_#ROWNUM#',
                      p_item_label                =>    'Label for f05_#ROWNUM#') "ATTENDANCE"
              If this is not the case then provide more info so, you will get quick solution from the experts.

              Regards,
              Jitendra