This discussion is archived
1 2 Previous Next 18 Replies Latest reply: May 21, 2012 9:43 AM by Charles A RSS

Hide and Show Region - Open if Item not Null

Charles A Newbie
Currently Being Moderated
Hello,
I am using APEX 4.0 and can not figure out how to have the Hide and Show Region expand if a Page Item has a value (Is not Null) within the region, without clicking the plus sign. I would like this done automatically based on an item having a value or not; null or not null. I know how to always have the Hide and Show Region show/expand once the form is present. But if item is null the region should not be open on the page load but when a item has value when the page is opened I would like the region to be open/expand without having to click the plus sign. I have searched the forum and have found alot of threads about just having the Hide and Show Region open/expand once the page form is open but that is not what I need currently. Thanks for reading this thread and look forward to any assitance for this issue.
  • 1. Re: Hide and Show Region - Open if Item not Null
    VC Guru
    Currently Being Moderated
    Edit you region > Region Attributes > Enter a value for Region StatiC ID (lets say MY_ID)

    Now you can hide/show the region using below javascript, in your case create a onchange event on the item to execute this
    $x_Show('MY_ID');
    $x_Hide('MY_ID');
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/javascript_api.htm#CHDDAGFE

    http://www.w3schools.com/jsref/event_onchange.asp

    Thanks
  • 2. Re: Hide and Show Region - Open if Item not Null
    Charles A Newbie
    Currently Being Moderated
    VC Thanks for response, I created a function
    function show_hide()
    {
    $x_Show('P49_COND_FK_EMPL_ID');
    $x_Hide('P49_COND_FK_EMPL_ID');
    }
    and once the value is selected the item does disappear. But I want the Hide and Show Region to expand once the page is displayed after the initial P49_COND_FK_EMPL_ID item was created. Once I click the Create/Apply Changes button if P49_FK_EMPL_ID value is not null/exist then when I go to page 49 again the Hide and Show Region should display and be expanded wthout having to click the plus sign. Do you have any other suggestions on achieving this? If my question is not clear let me know so I can go into more details if needed. Thanks for reply again.
  • 3. Re: Hide and Show Region - Open if Item not Null
    VC Guru
    Currently Being Moderated
    Charles A wrote:
    VC Thanks for response, I created a function
    function show_hide()
    {
    $x_Show('P49_COND_FK_EMPL_ID');
    this shows the region
    $x_Hide('P49_COND_FK_EMPL_ID');
    this hides the region, which runs after the above
    }
    Just use one of them based on your login, on page load call the Show API
  • 4. Re: Hide and Show Region - Open if Item not Null
    Charles A Newbie
    Currently Being Moderated
    VC,
    This works for the Page Item but I am focusing on the Hide and Show Region, the plus and minus sign. This will hide and show the item P49_COND_FK_EMPLID but has no affect on the Hide and Show Region it self. I need to have the region open based on Item value and if there is no value for the item the region should be closed. Is there a way this logic can affect the Hide and Show Region for the plus and minus sign?
    Works for Page Item but not the Region plus or minus sign, need to automate the plus and minus sign; do not want end-user to click plus sign if value exists for item.
    function show_hide()
    {
    $x_Show('P49_COND_FK_EMPL_ID');
    }
    function show_hide()
    {
    $x_Hide('P49_COND_FK_EMPL_ID');
    }
    Edited by: Charles A on May 16, 2012 8:38 AM
  • 5. Re: Hide and Show Region - Open if Item not Null
    VC Guru
    Currently Being Moderated
    If you read my original post correctly, i mean region ID

    Same thing works for region STATIC ID's

    Edit you region > Region Attributes > Enter a value for Region StatiC ID (lets say MY_REGION_ID)

    Now you can hide/show the region using below javascript, in your case create a onchange event on the item to execute this
    $x_Show('MY_REGION_ID');
    $x_Hide('MY_REGION_ID');
  • 6. Re: Hide and Show Region - Open if Item not Null
    Charles A Newbie
    Currently Being Moderated
    VC, I appreciate the replies; here is exactly what I have implemented. Let me know if this is not what you are stating.
    Edit Page
    HTML Header and Body Attribute
    HTML Header
    function show_hide()
    {
    $x_Show('MY_REGION_ID');
    $x_Hide('MY_REGION_ID');
    }
    Regions
    I have clicked Edit on the Hide and Show Region
    Attributes
    Static ID: MY_REGION_ID

    Now for my Item within the Hide and Show Region I have a onchange.
    Page Item
    P49_COND_FK_EMPL_ID
    Element
    HTML Form Element Attributes: onchange="show_hide(this.value)";

    When the Employee Id has a value the region is not expanded, i still have to click the plus sign.
  • 7. Re: Hide and Show Region - Open if Item not Null
    VC Guru
    Currently Being Moderated
    Charles A wrote:
    VC, I appreciate the replies; here is exactly what I have implemented. Let me know if this is not what you are stating.
    Edit Page
    HTML Header and Body Attribute
    HTML Header
    function show_hide()
    {
    $x_Show('MY_REGION_ID');
    $x_Hide('MY_REGION_ID');
    }
    Regions
    I have clicked Edit on the Hide and Show Region
    Attributes
    Static ID: MY_REGION_ID

    Now for my Item within the Hide and Show Region I have a onchange.
    Page Item
    P49_COND_FK_EMPL_ID
    Element
    HTML Form Element Attributes: onchange="show_hide(this.value)";
    I When the Employee Id has a value the region is not expanded, i still have to click the plus sign.
    in your function you are showing and then hiding the same region, what is the point of that?

    You must use two different function to do two different thins
    function show()
    {
     $x_Show('MY_REGION_ID');
    }
    
    function hide()
    {
     $x_Hide('MY_REGION_ID');
    }
  • 8. Re: Hide and Show Region - Open if Item not Null
    Charles A Newbie
    Currently Being Moderated
    VC, sorry for late response but I added the two different functions and this is still not what is expected. I am not clear on how this will affect the Region? Would you like to log into a test application and see exactly what I am doing wrong and/or what functionality is occurring?
    function show()
    {
     $x_Show('MY_REGION_ID');
    }
     
    function hide()
    {
     $x_Hide('MY_REGION_ID');
    }
    Edited by: Charles A on May 17, 2012 10:59 AM
  • 9. Re: Hide and Show Region - Open if Item not Null
    Charles A Newbie
    Currently Being Moderated
    Hello All,
    Can anyone assist me with this issue?
  • 10. Re: Hide and Show Region - Open if Item not Null
    VC Guru
    Currently Being Moderated
    can you put this on apex.oracle.com?
  • 11. Re: Hide and Show Region - Open if Item not Null
    Charles A Newbie
    Currently Being Moderated
    Hey VC,
    Yes,

    Click the Customers tab which will display the Customers report on Page 2. Once the Edit icon is clicked the Form on Page 7 will display. The items are in a Hide and Show Region. Lets focus on State item, if State has a value the Hide and Show Region should display without clicking the > sign in the Hide and Show Region. But if there is no State value then the Hide and Show Region > should be clicked to expand the region; which will display the data. If you need anything other information feel free to ask me and thanks for follow up.

    Edited by: Charles A on May 21, 2012 6:48 AM

    Edited by: Charles A on May 21, 2012 8:37 AM
  • 12. Re: Hide and Show Region - Open if Item not Null
    VC Guru
    Currently Being Moderated
    login credentials not visible!!
  • 13. Re: Hide and Show Region - Open if Item not Null
    Charles A Newbie
    Currently Being Moderated
    Hey VC,
    I added them back, thanks for the follow up and assistance with this. I look forward to seeing your implementation. Thanks
  • 14. Re: Hide and Show Region - Open if Item not Null
    VC Guru
    Currently Being Moderated
    Hi Charles,

    I have created a dynamic action on page 7, it works as expected.

    This code will only work with your current theme, because the toggle is done based on the css class of the > icon(as you can see in the true action)


    Thanks
1 2 Previous Next

Legend

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