This discussion is archived
10 Replies Latest reply: Oct 12, 2012 2:50 PM by Gor_Mahia RSS

dynamic action issue

853243 Newbie
Currently Being Moderated
APEX - 4
DB version - 10g
Web server architecture - OHS
Browser - IE8
Theme - 5

Hello

I am trying to create a dynamic action to show and hide a number of items within a region. It looks simple enough, I am trying to show an hide items based on the value of a static select list. I used some out put statements to prove that my select list item values are changing as I would expect, but the buttons are not showing and hiding and I am now getting the error message.

My select list has the values
STATIC2:Status Maintenance;S,Box Assignments;B,Holds;H,Checkouts;C
with page action when value changed set to
submit page

My dynamic action is setup as

standard
selection type = item
condition = equal to
value = S
Specify the true action = Show
Create opposite false action is checked
selection type = item
I have selected three buttons to show and hide

and when I change the value of the select list I get the following error.

ORA-00001: unique constraint (APEX_040000.WWV_FLOW_COLLECTIONS_UK) violated

Any help would be appreciated.

Thank you
  • 1. Re: dynamic action issue
    GarryLawton Explorer
    Currently Being Moderated
    Hi,
    I dont think you can access buttons as items in dynamic actions. Someone tell me if I am wrong. You can however access them with JQuery selectors. So if you give the button an id of BUTTON1 you can hide the button using the JQuery selector #BUTTON1 You can set the id by entering id="BUTTON1" in the button attributes. Make sure the template you are using includes #BUTTON_ATTRIBUTES#

    Regards Garry
  • 2. Re: dynamic action issue
    Kiran Expert
    Currently Being Moderated
    Hi,

    Depends on button type you are using:
    1) HTML button
    2) Template based button

    If it is a Template based button:
    $('button[type="button"][value="Cancel"]').hide();
    It is a jQuery code which I tried on a template based button with Text Label/Alt as "Cancel"
    which is used in above code *[value="Cancel"]*.
    The normal show-hide mechanism don't work on Template Based Button
    as it is not constructed using *<input></input>* internally in ApEx but using *<button></button>*
    and hence they do not have any attribute id.

    Hope this helps!
    Regards,
    Kiran
  • 3. Re: dynamic action issue
    Kiran Expert
    Currently Being Moderated
    Hi,

    Try this:
    Use Advanced Dynamic Action
    Event: Change
    Selection Type: Item(s)
    Item(s): <select-list>
    Condition: equal to
    Value: H(In case if you want trigger dynamic action when Holds is selected from select list)
    Action: Execute JavaScript Code
    Code:
    $('button[type="button"]').val("Cancel","Next").hide();
    If you have two template based button with Text Label/Alt as "Cancel" and "Next"
    which is used in above code val("Cancel","Next").
    Page elements you would like the dynamic action to control: No elements
    After creating the dynamic action add a False Action:
    Action: Execute JavaScript Code
    Code:
    $('button[type="button"]').val("Cancel","Next").show();
    For the select list Page Action when Value Changed attribute keep it as None(Default)
    as the Dynamic Action is based on AJAX methodology(Partial Page Refresh)!

    Regards,
    Kiran
  • 4. Re: dynamic action issue
    GarryLawton Explorer
    Currently Being Moderated
    Hi,
    you said "The normal show-hide mechanism don't work on Template Based Button"

    Hiding and showing buttons does work with template buttons as I explained in a previous posting. You only have to add #BUTTON_ATTRIBUTES# to the template if it is missing, then you give the button an id and use a JQuery selector. No javascript is needed.

    Regards Garry
  • 5. Re: dynamic action issue
    853243 Newbie
    Currently Being Moderated
    Hello

    Thank you for you assistance, I am trying your suggestion (I am very new to html and javascript) I think it may be working except it is not showing and hiding my button that I have already defined on the screen, it is adding a new button on the page and showing and hiding it.

    I have a button on my page as follows

    Name = P2_REACTIVATE
    button label = Reactivate
    Button Request = REACTIVATE

    $('button[type="button"]').val('REACTIVATE').hide();
    $('button[type="button"]').val('REACTIVATE').show();

    I have tried to change the value in .val() to the following with the same results

    "REACTIVATE"
    "#REACTIVATE"
    "P2_REACTIVATE"
    "#P2_REACTIVATE"

    'REACTIVATE'
    '#REACTIVATE'
    'P2_REACTIVATE'
    '#P2_REACTIVATE'


    this code seems to be adding a new button on page called what is entered after $('button[type="button"]').val('
    and ignoring my button.

    here is some source html from the page that I hope shows what is going on with this button and my dynamic action.

    <td colspan="1" rowspan="1" align="left"><table cellpadding="0" cellspacing="0" border="0" summary="" class="t5Button">
    <tr>
    <td class="t5R"><a class="t5NoWarning" href="javascript:apex.submit('REACTIVATE');"><img src="/i/themes/theme_5/button_left.png" alt="" /></a></td>
    <td class="t5C"><a class="t5NoWarning" href="javascript:apex.submit('REACTIVATE');" class="t5C">Reactivate</a></td>
    <td class="t5L"><a class="t5NoWarning" href="javascript:apex.submit('REACTIVATE');"><img src="/i/themes/theme_5/button_right.png" alt="" /></a></td>
    </tr>

    $('#P2_FILE_ID').val($(this.triggeringElement).val());
    },"action":"NATIVE_JAVASCRIPT_CODE"},{"eventResult":true,"executeOnPageInit":false,"stopExecutionOnError":true,javascriptFunction:apex.da.executePlSqlCode,"ajaxIdentifier":"45D0A42B5F6C7F5032119699B17DC39351A2A494CEC63638A3460E6811436F89","attribute01":"P2_FILE_ID","action":"NATIVE_EXECUTE_PLSQL_CODE"}]},{"triggeringElement":"P2_UPDATE_TYPE","triggeringElementType":"ITEM","triggeringConditionType":"EQUALS","triggeringExpression":"H","bindType":"bind","bindEventType":"change",actionList:[{"eventResult":true,"executeOnPageInit":true,"stopExecutionOnError":true,"affectedRegionId":"R67045672860889399",javascriptFunction:function (){ $('button[type="button"]').val('REACTIVATE').hide();
    },"action":"NATIVE_JAVASCRIPT_CODE"},{"eventResult":false,"executeOnPageInit":true,"stopExecutionOnError":true,"affectedRegionId":"R67045672860889399",javascriptFunction:function (){ $('button[type="button"]').val('REACTIVATE').show();
    },"action":"NATIVE_JAVASCRIPT_CODE"}]}



    any help would be appreciated.

    Thank you
  • 6. Re: dynamic action issue
    GarryLawton Explorer
    Currently Being Moderated
    Hi,
    take a look at this, is this what you want to do?. If so, i'll send you the app export. It uses JQuery selectors, no scripting is needed.

    http://apex6.revion.com/pls/apex/f?p=552

    Regards Garry
  • 7. Re: dynamic action issue
    853243 Newbie
    Currently Being Moderated
    Yes this is what I am trying to do, thank you
  • 8. Re: dynamic action issue
    GarryLawton Explorer
    Currently Being Moderated
    Hi,
    here is the export

    http://dl.dropbox.com/u/4467071/f552.sql

    Regards Garry
  • 9. Re: dynamic action issue
    853243 Newbie
    Currently Being Moderated
    Thank you very much, I have it working the way I wanted now.
  • 10. Re: dynamic action issue
    Gor_Mahia Explorer
    Currently Being Moderated
    Garry
    iam asking if can please send to me this sample code i really need something similar...regards.

Legend

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