This discussion is archived
9 Replies Latest reply: Nov 27, 2013 3:23 AM by AnnMary RSS

Dynamic Action in Detail Region in a Master Detail form

AnnMary Newbie
Currently Being Moderated

Let me Explain what exactly is happening in my application . This is a Gate pass Form Application

Where I have a Visitor Gate pass Form  & a  Material gate pass Form .(MGPF)

 

Our topic of concern is about the MGPF . This MGPF is a master detail form

 

the master region consists of various child regions such as the following

 

-Material Gate Pass Form

-Agent Details

-Reference Information

-Official Information

 

in this Material Gate Pass Form(child region)  is the first region where the first Item is

Gate Pass Type : ( it is a select list Item and the select options are )

                             1. returnable gate pass         

                             2.Non  returnable gate pass

                             3. Other gate pass


 

, where in the detail / report region of the entire form  is ITEM DETAILS and it consists of items like

 

Sl No    Item    Uom    Quantity   Line Status.

                                                    (line status is a SELECT LIST)

 

Now when I select   GATE PASS TYPE -> as Non Returnable Gate Pass  ( in master region i.e form )


I want a dynamic action to happen , such that  (REPORT ATTRIBUTE i.e report item LINE STATUS  should be greyed out !!!


so I have done that by a dynamic action - using jquery statement (.Disable) .

 

Defining the element attributes as Disable .

 

dynamic action in details


dynamic action to disable Line status (column ) in the detail region  when we select (non returnable ) in the form

 

DYNAMIC ACTION

 

TO  DISABLE_ITEM_DETAILS

 

EVENT - change

SELECTION TYPE - items

ITEM-  Line Statu

CONDITION -equal to

VALUE- non returnable

 

 

TRUE ACTION

Sequence                    -10

Action                          -Disable

Fire On Page Load         -Yes

Selection Type              - jQuery Selector

Affected Elements          - .Disable

 

 

 

FALSE ACTION

Sequence                    -10

Action                          -Enable

Fire On Page Load         -Yes

Selection Type              - jQuery Selector

Affected Elements          - .Disable

 

 

EVENT SCOPE : Dynamic

   ------------------------------------------------------

 

REPORT REGION -> EDIT -> REPORT ATTRIBUTES ->COLUMN ATTRIBUTES -> ELEMENT ATTRIBUTES -> class="Disable"

 

 

these are what i have done !

.

So when I click or select the Non returnable gate pass   the column Line status in the report region becomes greyed out .


the problem faced is that . as i start entering text into the form . First I will select the TYPE as  Non returnable gate pass 

Then fill in the remaining details  and then finally come in to the report region . Initally there will not be any row created in the table in the report region .


                                                                                                     Delete Row      ADD ROW

 

SL NO:
ITEM ID
UOMQUANTITYLine Status
1

 

when I click the ADD ROW  .

a row is inserted but  HERE COMES THE PROB !! LINE STATUS REMAINS OPEN / accessible TO SELECT  OPTION  instead of being a greyed field .


But when i go back to the GATE PASS TYPE n change the option as returnable and then select non returnable option .. this LINE  STATUS becomes greyed out .

This procedure has to repeat every time I create a new row  in the same page , I will have to go to the TYPE n toggle between the options in the select list and select the Non returnable option  after adding a new row ,so that Line status becomes greyed out !!

. Please help me solve this !


FEW SUGGESTIONS SUCH AS THE FOLLOWING WHERE GIVEN .i TRIED BUT DID NOT WORK


1. find  out name of tabular form column by using debug or pressing F12

 

its like input[name="f01"]

and use these value as a jQuery selector

Means

Affected Elements = input[name="f0X"] (here X is name of tabular form column)

like in your action

try this


2. try following one

 

Action: Execute javascript Code

code : $('input[name="f09"]').attr('disabled', 'disabled');

 

 

TRIED THE ABOVE 2 OPTION BUT DID NOT GIVE A POSITIVE RESULT .

  • 1. Re: Dynamic Action in Detail Region in a Master Detail form
    Joni Vandenberghe Pro
    Currently Being Moderated

    Hi AnnMary,

     

    I skipped the story and went straith to your code :-)

    There I noticed that your selectors are incorrect: lose the "" that suround f0X. I don't think your actually using an X in your code but just incase: replace it.

    Your selector is calling an actual function that passes a string, so don't put another string inside a string!

     

    So either

    input[name=f09]

    or

    $('input[name=f09]').attr('disabled', 'disabled');


    Tip: always test your selectors in your console first before using it in code!

    Kind regards,

    Joni

  • 2. Re: Dynamic Action in Detail Region in a Master Detail form
    AnnMary Newbie
    Currently Being Moderated

    Hi Joni

     

    Thank you for your input ! I tried the same as suggested by you . But it did not work ! Any other options !

     

    Regards

    Ann

  • 3. Re: Dynamic Action in Detail Region in a Master Detail form
    Joni Vandenberghe Pro
    Currently Being Moderated

    Hi AnnMary,

     

    Your problem is that when you click add Row the change event does not fire, so for the new row, the fields are not disabled.

    You need to bind a dynamic action to your Add Row button. Instead of action go to URL, select dynamic action on your button.

    Then create a Dynamic Action that has as event clicking the Add Row button.

    As action put some javascript code:

    Start with javascript:apex.widget.tabular.addRow(); to add the actual row, and then check the value of the item (use :$('#PX_ITEM_ID').val() to retrieve the value) and depending of that value(if/else) disable or enable the rows.

     

    Regards,

    Joni

  • 4. Re: Dynamic Action in Detail Region in a Master Detail form
    AnnMary Newbie
    Currently Being Moderated

    Thank You Joni

     

    I understand the concept which you have specified. I think this might be the perfect solution. Now here comes the next challenge that am facing . Am very new to APEX and am learning it . same applies to java script as well.

    Can you please help me step by step (if u don mind ) as to what has to be done from my end . Just like Apex ..Like a wizard .I would be really great full.

     

    Regards

    ann

  • 5. Re: Dynamic Action in Detail Region in a Master Detail form
    AnnMary Newbie
    Currently Being Moderated

    hi Joni

    I was successful in changing the button from URL to dynamic action

    And then proceeding with the dynamic action creation until the execute Java Script code .

     

    I really am helpless to take a step ahead as am I am really a stranger to java ! ..can u help me with this , am sure this suggestion of yours will work out ..I would be really great full. if u can help me further

     

    Regards

    Ann

  • 6. Re: Dynamic Action in Detail Region in a Master Detail form
    Joni Vandenberghe Pro
    Currently Being Moderated

    Hi Ann,

     

    Your javascript code would look something like this:

    apex.widget.tabular.addRow();

    if($('#PX_MY_ITEM_NAME').val()=='ValueNeededForDisable'){

    $('input[name=f09]').attr('disabled', 'disabled');

    }

    else
    {

    $('input[name=f09]').removeAttr('disabled');

    }


    Replace the text in bold by the correct values.


    Regards,

    Joni

  • 7. Re: Dynamic Action in Detail Region in a Master Detail form
    AnnMary Newbie
    Currently Being Moderated

    Hi Joni

    Thank you for your valuable inputs. I tried the same . Now there is some improvement .

    Now as soon as i open the gate pass form I have a row inserted by default hence i do not have to click ADD ROW button to add the first row  . There by when I Select the TYPE as NON RETURNABLE it automatically greys out the LINE STATUS field in the First row which is already created or automatically generated at the start. So far its perfect!!!

     

    Now the problem is when I click the ADD ROW button again to insert a new row . The previous problem is back to its form . Meaning to say the LINE STATUS column is not greyed out , and toggling between the TYPES option -( chnaging from non returnable to returnable and then changing to non returnable type ) brings it back to greyed field . !!! Manual intervention is required !

     

       Delete Row      ADD ROW

     

    SL NO:
    ITEM ID
    UOMQUANTITYLine Status
    1by default this is greyed out!! as soon as i selected the TYPE option as
    NON RETURNABLE

     

    NOW WHEN I PRESS ADD ROW TO INSERT NEW ROW

     

       Delete Row      ADD ROW

     

    SL NO:
    ITEM ID
    UOMQUANTITYLine Status
    1by default this is greyed out!! as soon as i selected the TYPE option as
    NON RETURNABLE
    2THIS IS NOT GREYED FIELD !! REMAINS OPEN TO ENTERING DATA  AND IF I GO UP TO THE MASTER AND CHANGE THE ITEM TYPE:   FROM NON RETURNABLE TO RETURNABLE AND THEN SELECT NON RETURNABLE ! IT BECOMES GREYED OUT

     

     

    HOPE  u have understood what exactly is happening now !

     

    Can you please help me sort this!

  • 8. Re: Dynamic Action in Detail Region in a Master Detail form
    Joni Vandenberghe Pro
    Currently Being Moderated

    Hi Ann,

     

    I understand what is happening yes, but it's hard to debug with the information you give me. Did you implement the DA I suggested? Is anything showing up on the console when you click the Add Row button? Or can you create an example on apex.oracle.com?

     

    Regards,

    Joni

  • 9. Re: Dynamic Action in Detail Region in a Master Detail form
    AnnMary Newbie
    Currently Being Moderated

    hey Joni

     

    Sorry for the late response ! Was not doing good since a week and above ! Thanks a lot for your support and help ! i have arrived with a  solution for this issue! Instead of this scenario i just made that particular column in detail (report region ) disable in the respective type !! and it worked .

     

    Any way . Thanks a lot Joni

     

    Regards & Thanks

    Ann

Legend

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