This discussion is archived
1 2 Previous Next 25 Replies Latest reply: Jul 16, 2013 8:53 AM by KarenH Go to original post RSS
  • 15. Re: help with updating a tabular form using a Dynamic Action
    Tom Petrus Expert
    Currently Being Moderated

    Karen,

    It really seems like you could use some crash course on debugging javascript and html, doesn't it?

    Honestly, it isn't that hard, provided you have the good tools. When you use Firefox, then go and get the firebug plugin: http://getfirebug.com , or use Chrome. Both have great tools to make inspecting your HTML easier, as well as inspect ajax calls and have useful console. Hit F12 to bring the developer tools up in either browser.

    The next thing you should use when debugging is the apex "Debug" button. It is not only useful for debugging server side, but will also log message to the browser's console. Messages such as 'Dynamic Action Fired: On modal destinations close refresh (NATIVE_REFRESH)" yadayadayada and will also include dynamic action specific objects.

    For example, in Chrome, inspecting a call:

     

    Object {triggeringElement: document, affectedElements: jQuery.fn.jQuery.init[1], action: Object, browserEvent: jQuery.Event, data: Object…}

     

    1. action: Object
    2. affectedElements: jQuery.fn.jQuery.init[1]
    3. browserEvent: jQuery.Event
    4. data: Object
    5. resumeCallback: undefined
    6. triggeringElement: document
    7. __proto__: Object

    This is hugely interesting to debug your things, as you can actually see what triggered something and what values are being passed on.
    Also don't forget you can use console.log("some message") to write code to the console from javascript code. For instance, might be interesting to add a javascript true action somewhere with just some console.log in it to get an even better grasp on it.

    Now if you want to find out exactly what a certain selector will get, you can also run code on your page from the console. Need to know what ".hmsinfo" will select? Just run $(".hmsinfo") from the console. An object will be logged to show you all the selected elements, if any.

  • 16. Re: help with updating a tabular form using a Dynamic Action
    KarenH Newbie
    Currently Being Moderated

    Thanks Tom!

     

    ah yes...many crash courses are needed!  this is quite helpful and I have just started using firefox as opposed to IE to help debug, so I will investigate further....of course, I am feeling the pressure of tight deadlines, so also trying to press on....never a good strategy.   Your point is well taken.  thanks

  • 17. Re: help with updating a tabular form using a Dynamic Action
    DLittle Explorer
    Currently Being Moderated

    Karen,

     

    Anytime I debugging pl/sql in packages or in apex dynamic actions or application processes I find it helpful to have a debug table where I can insert all sorts of data to help me track my problems.  Below is an example of a table and a procedure I use:

     

    -- script to create table

      CREATE TABLE xxx.debug

       (   ID NUMBER,

           value1 CLOB,

        value2 CLOB,

         CREATION_DATE DATE,

          CREATED_BY VARCHAR2(100 BYTE)

       );

     

    ------- Script for sequence

     

       CREATE SEQUENCE  xxx.seq_debug_id  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLE ;

     

    --- script for procedure

     

      CREATE OR REPLACE PROCEDURE DEBUG_COMMIT (p_val1 clob,p_val2 clob) AS

      PRAGMA AUTONOMOUS_TRANSACTION;

    BEGIN

      insert into xxx.debug (id,value1,value2,creation_date,created_by)

                   values (seq_debug_id.nextval,p_val1,p_val2,sysdate,nvl(v('APP_USER'),user));

      COMMIT;

    END debug_commit;

     

    /

  • 18. Re: help with updating a tabular form using a Dynamic Action
    Kofi Journeyer
    Currently Being Moderated

    HI Karen,

    Just looked at the app and since I can't run it, it's difficult to debug. Though there seems to be a lot to do. For one you seem to still be using the input selectors which means you're still vulnerable to changes.

    The whole point of a class is to be able to provide another layer to abstract that. Also should your item names be lowercase?  For example :p110_ID. I suspect they should be uppercase.

    I'd also go with Dlittle(?)'s suggestion of a table that you can store the actual values you're dealing with to see what's happening.

    My whole approach to this would be a little different but I'm not going to get you to deviate from your path at this stage.

    Kofi

  • 19. Re: help with updating a tabular form using a Dynamic Action
    KarenH Newbie
    Currently Being Moderated

    thanks Kofi.  yes, I am still using input for some of the items...but my intent is to move those into classes as well...once I get this update member working for the collection.

     

    I would be happy to give you access to my own workspace as a guest, but I suspect that is not the best protocol.  This is a big application and a lot going on....perhaps I can weed certain components out so that it can be run.  I will get back to you.  thanks

  • 20. Re: help with updating a tabular form using a Dynamic Action
    KarenH Newbie
    Currently Being Moderated

    I am still unable to simply update my collection and receive the following error:

     

    AJAX call returned server error ORA-20103: Member sequence  does not exist in application collection "SPECIES_COLLECTION" for Execute PL/SQL Code

     

    Note, in the above message,the value for sequence does not appear....as if it is set to NULL.

     

    In my Dynamic Action, I have been playing around with how to set a page item called P110_SEQ.

     

    I now have:

    dynamic action:  COLUMN CHANGE

    event: CHANGE

    selection type: JQUERY SELECTOR

    jquery selector: input[name='f10'],input[name='f11'],input[name='f12'],input[name='f24'],textarea[name='f28'],select[name='f40'],input[name='f41']

     

    true action1: set value, javascript expression, set P110_ID = this.triggeringElement.id

    true action2: set value, javascript expression, set P110_VALUE = this.triggeringElement.value

    true action3: set value: javascript expression, set P110_SEQ = $('#'+'f01_'+$('#P110_ID').val().substring(4)).val();   (*** this is based on earlier help from Denes Kubicek blog: http://apex.oracle.com/pls/apex/f?p=31517:294:108052168279305::NO )

    true action4: pl/sql

    declare
      v_attr number;
      v_seq varchar2(3);
    begin 
      v_attr := TO_NUMBER (SUBSTR (:P110_id, 2, 2));
      select ltrim(substr(:P110_ID,5,4),'0') into v_seq from dual;
    apex_debug.message(' v_seq= '||v_seq); 
    apex_debug.message(' v_attr= '||v_attr); 
    apex_debug.message(' v_value= '||:P110_VALUE);
      safis_collections.update_column( :P110_SEQ,
                                       v_attr,
                                       :P110_VALUE);
    end;
    
    

     

    the procedure is:

     

    procedure update_column(v_seq in varchar2,
                            v_attr in number,
                            v_value in varchar2)
    is

    begin
       apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
                         p_seq => v_seq,
                         p_attr_number => v_attr,
                         p_attr_value  => v_value);
    apex_debug.message('updated column. seq='||v_seq||' attribute='||v_attr||' with '||v_value);

     

    end;

     

    still no luck.   I am sure it has something to do with the P110_SEQ value not being properly set....and have played around with using F01 and F02 in true action 3.  sigh.

     

     

    ps.  if I hardcode '1' in as the value for P110_SEQ it works perfectly.

  • 21. Re: help with updating a tabular form using a Dynamic Action
    Kofi Journeyer
    Currently Being Moderated

    Let's assume your value of P110_SEQ is right.

    Are you returning P110_SEQ in the true action

    begin

      null;

    end;


    Do you see the value P110_SEQ in the session?

    Kofi

  • 22. Re: help with updating a tabular form using a Dynamic Action
    KarenH Newbie
    Currently Being Moderated

    Hi Kofi, yes, I have that true action, but do not see the value of P110_SEQ.

     

    I am now directly updating the member (not calling my update member db procedure):

     

    declare

      v_attr number;
     

    begin
      v_attr := TO_NUMBER (SUBSTR (:P110_id, 2, 2));

     

      apex_collection.update_member_attribute
                       (p_collection_name      => 'SPECIES_COLLECTION',
                        p_seq                  => :P110_SEQ,
                        p_attr_number          => v_attr,
                        p_attr_value           => :P110_VALUE);

    end;

     

     

    this is true action 4 and SUBMITS the items P110_ID, P110_VALUE, P110_SEQ

     

    both P110_ITEM and P110_VALUE are shown in session as the values they should be...however, P110_SEQ remains null.   The collection only seems to update when I explicitly provide it with a seq (and it works both in quotes and as numeric...which I had been wondering about).

     

    currently, P110_ITEM, P110_VALUE, and P110_SEQ are all defined as TEXT fields and are shown on the page. 

     

    thanks!

     


  • 23. Re: help with updating a tabular form using a Dynamic Action
    Kofi Journeyer
    Currently Being Moderated

    Can you replace your P110 on apex.oracle.com with your current page?

    Kofi

  • 24. Re: help with updating a tabular form using a Dynamic Action
    KarenH Newbie
    Currently Being Moderated

    Thanks again Kofi, I really appreciate your taking a look at this.  I just placed a replacement for the application on the oracle apex workspace:

     

    SAFIS

    tester

    fish

     

     

    application 17465 

     

    ps. Kofi, I noticed when I inspect each item in the tabular form, some appear as f10_1, f10_2, f10_3 (for example the three rows corresponding to c010=dollars).   While others, appear as f28_0001, f28_0002 (for c028=explanation).

     

    I think this is the problem because P110_SEQ is calculated as

     

    $('#'+'f02_'+$('#P110_ID').val().substring(4)).val();

     

    so, it appears that p110_seq has a value set when I change f28_0001, but not when I change f10_2. 

     

    I am limited by my knowledge of javascript but will do some research to see if there is some sort of rtrim feature available.

     

    thanks

  • 25. Re: help with updating a tabular form using a Dynamic Action
    KarenH Newbie
    Currently Being Moderated

    I think I may have solved the issue.

     

    dynamic action:  COLUMN CHANGE

    event: CHANGE

    selection type: JQUERY SELECTOR

    jquery selector: input[name='f10'],input[name='f11'],input[name='f12'],.shark_info, .hms_info

     

    true action1: set value, javascript expression, set P110_ID = this.triggeringElement.id AFFECTED ITEM P110_VALUE

    true action2: execute pl/sql code

    begin
    null;
    end;

    page items to submit: P110_ID

    true action3: set value, javascript expression, set P110_VALUE = this.triggeringElement.value AFFECTED ITEM P110_VALUE

    true action4: set value: PL/SQL expression, set P110_SEQ = rtrim(substr(:P110_ID,5,4),'0')    AFFECTED ITEM: P110_SEQ

    true action5: execute pl/sql code

    declare
      v_attr number;
      
    begin 
      v_attr := TO_NUMBER (SUBSTR (:P110_id, 2, 2));
      apex_collection.update_member_attribute
                       (p_collection_name      => 'SPECIES_COLLECTION',
                        p_seq                  => :P110_SEQ,
                        p_attr_number          => v_attr,
                        p_attr_value           => :P110_VALUE);
    end;

    page items to submit: P110_ID, P110_VALUE, P110_SEQ

     

    true action6:  refresh region

     

     

    I think it was the combination of using pl/sql expression to calculate P110_SEQ and also your helpful tip about TRUE ACTION2 to submit the item which did the trick.

     

    thank you Kofi, for your patience and your help!  it was tremendous.

     

     

    ugh...onto the next issue. 

     

    Karen

1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points