This discussion is archived
8 Replies Latest reply: May 6, 2013 3:05 AM by 1001049 RSS

I need some help with apex_item.date_popup2

1001049 Newbie
Currently Being Moderated
Hi everyone,

I just recently found out about apex_item.date_popup2 and I'm having some trouble working with it.
I'm not sure how to associate it with a attribute I have already.
My select for the popup so far is:

...
apex_item.date_popup2(30, sysdate, 'DD.MM.YYYY HH24:MI', 15, 10, null, null, null, sysdate, null, sysdate) as "DATUM_OD_TEST"
...

But when I press "add row" in my tabular form it just adds "(null)" at the end.

Edited by: Luka_APEX on 26.4.2013 4:10
  • 1. Re: I need some help with apex_item.date_popup2
    Denes Kubicek Oracle ACE Director
    Currently Being Moderated
    Probably you should set the column type to "Standard Report Column" instead of "Display As Text..." but the standard add row function doesn't work with the manual tabular form.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------
  • 2. Re: I need some help with apex_item.date_popup2
    1001049 Newbie
    Currently Being Moderated
    Thank you for your reply. It is set as "Standard Report Column", but when adding new rows it still only displays the text "(null)".
    What do you mean the standard add row doesn't work? How do you add rows then when using APEX_ITEM.* ?
  • 3. Re: I need some help with apex_item.date_popup2
    Denes Kubicek Oracle ACE Director
    Currently Being Moderated
    As far as I know this is still the way to do that:

    https://apex.oracle.com/pls/apex/f?p=31517:170

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------
  • 4. Re: I need some help with apex_item.date_popup2
    sect55 Journeyer
    Currently Being Moderated
    You can use a dynamic action, as follows:

    Name: Add Row
    Seq: any number

    Event: Click
    Selection Type: Button
    Button: Add (Add Row)
    Condition : No Condition

    True Action
    Seq 10
    Action Excecute JavaScript Code
    Fire On Page Load
    Edit:
    File When Event Result is True
    Settings: addRow();

    Robert
    http://apexjcsjss.blogspot.com
  • 5. Re: I need some help with apex_item.date_popup2
    Denes Kubicek Oracle ACE Director
    Currently Being Moderated
    Sure, you can add the same to the button and don't need a dynamic action for that. The problem is the apex_item function in the query. This won't work with the standard feature.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------
  • 6. Re: I need some help with apex_item.date_popup2
    1001049 Newbie
    Currently Being Moderated
    Thanks for your replies, but I'm having real trouble getting this to work, and quite honest, it seems like a lot of code and work just so I can have the item popup show dates from current date forward... is there another way to do that? Or maybe a simple validation process before submit that checks if the date is before sysdate?
  • 7. Re: I need some help with apex_item.date_popup2
    VC Guru
    Currently Being Moderated
    Luka_APEX wrote:
    Hi everyone,

    I just recently found out about apex_item.date_popup2 and I'm having some trouble working with it.
    I'm not sure how to associate it with a attribute I have already.
    My select for the popup so far is:

    ...
    apex_item.date_popup2(30, sysdate, 'DD.MM.YYYY HH24:MI', 15, 10, null, null, null, sysdate, null, sysdate) as "DATUM_OD_TEST"
    ...

    But when I press "add row" in my tabular form it just adds "(null)" at the end.
    Hello,

    It seems you are trying to add a dummy datepicker column to standard tabular form, if that's true then you should try this:

    amend your tabular form SQL to add a dummy column as below and apply changes
    select
    ...
    ...
    null "TEST_DATEPICKER"
    from ....
    Go to report attributes and edit the new column TEST_DATEPICKER and set
    Display As Date Picker
    Number/Date Format DD.MM.YYYY HH24:MI
    Default Type PL/SQL Expression or Function
    Defaul sysdate
    please note that this will populate the default value as the date time when the page was rendered and won't fetch the current/live timestamp, to acheive this you may have to use a dynamic action
    also you can inspect the datepicker in chrome/firefox browser to find its internal name attribute i.e. fxx

    See this example http://apex.oracle.com/pls/apex/f?p=9001:6
    Login as test/test

    Cheers,
    Vikram
  • 8. Re: I need some help with apex_item.date_popup2
    1001049 Newbie
    Currently Being Moderated
    Thank you Vikram for your input, but just as I got your reply I have solved my problem in a different way.

    My problem from the beginning was that I could not restrict from and to dates on the datepicker in my tabular form (like you can if you make a datepicker item).
    I have solved the problem with the help of another thread on the forum. I edited the addRow button to call my own addRow function wich is:

    function myAddRow(){
    apex.widget.tabular.addRow();
    $("td[headers='DATUM_OD'] input:last")
    .datepicker("option","changeMonth",false)
    .datepicker("option","minDate", "sysdate")
    .datepicker("option","maxDate", "+90");
    $("td[headers='DATUM_DO'] input:last")
    .datepicker("option","minDate", "sysdate")
    };

    this way I finnaly have the restrictions needed (from date cannot be before current date and not greater than 90 days ahead) in my tabular form.

    Thanks to all and I hope this thread helps someone else in the future also.

Legend

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