ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

dynamic_parameters won’t recognise start_on|stop_before

January 11, 2011 8:29am

Subscribe [3]
  • #1 / Jan 11, 2011 8:29am

    LucPestille

    146 posts

    Hi,
    I can’t get a particular set of dynamic_parameters to work correctly, but I can’t see where I might have gone wrong, or if anything I’ve used isn’t supported;

    <form action="/reports/csv" method="post">
    
    <div>
    <label>Start</label>
    <input type="text" name="start_on" id="start_on">
    </div>
    
    <div>
    <label>End</label>
    <input type="text" name="stop_before" id="stop_before">
    </div>
    
    <div class="action">
    <input type="submit" value="Generate report">
    </div>
    
    </form>

    That simple form (using jQuery UI datepickers on the text inputs) submits to this:

    {exp:weblog:entries weblog="orders" status="paid" dynamic_parameters="start_on|stop_before"}
        {order_items:table}
    {/exp:weblog:entries}

    {order_items:table} is a CartThrob tag - it should filter order by the dates I set, but the dynamic nature of it doesn’t seem to work. When I hard code the start_on + stop_before, using the values from the form in the first stage, it works fine…

    Is there anything special I have to do to use dynamic_parameters? Page caching is off for /reports/csv

    Thanks,

  • #2 / Jan 12, 2011 2:53am

    John Henry Donovan

    12339 posts

    LucPestille,

    I tested your setup like yourself and manually entering dates and it works like you say.
    So the issue here seems to be the datepicker and how that value is passed to the field.

    I don’t think it is an EE issuer persay so I am going to move this to the CodeShare Corner.

    Do however post your datepicker method so I can try on my setup here and I might catch something

  • #3 / Jan 12, 2011 5:04am

    LucPestille

    146 posts

    Hi John,
    I’m using a fairly simple setup, with jQuery UI datepicker (and a time addition addon) - I don’t know how much simpler it could be. Is there any way I can debug what EE sees in the $_POST?

    {if logged_in}
    
    <!doctype html>
    <html>
    <head>
    
        <meta charset="utf-8">
        <title>Ticket report</title>
        <link rel="stylesheet" href="/assets/css/ui-lightness/jquery-ui-1.8.7.custom.css">
        < script src="/assets/scripts/jquery-1.4.4.min.js"></ script>
        < script src="/assets/scripts/jquery-ui-1.8.7.custom.min.js"></ script>
        < script src="/assets/scripts/jquery-ui-timepicker-addon.js"></ script>
    
        < script>
        $(function() {
            $("#start_on, #stop_before").datetimepicker({
                dateFormat: "yy-mm-dd"
            });
        });
        </ script>
    
    
    </head>
    <body>
    
    <h1>Reporting</h1>
    
    <form action="/reports/csv" method="post">
    
    <div>
    <label>Start</label>
    <input type="text" name="start_on" id="start_on">
    </div>
    
    <div>
    <label>End</label>
    <input type="text" name="stop_before" id="stop_before">
    </div>
    
    <div class="action">
    <input type="submit" value="Generate report">
    </div>
    
    </form>
    
    </body>
    </html>
    
    {/if}

    Thanks,

  • #4 / Jan 13, 2011 8:30am

    LucPestille

    146 posts

    Anyone got any further ideas? This is the last piece of the puzzle I need for exporting reports, but not being able to select a range of dates makes it fairly worthless…

    Thanks,

  • #5 / Jan 13, 2011 11:24am

    LucPestille

    146 posts

    Also, in trying to bypass the dynamic parameters, and using php to extract the $_POST’d dates, I can’t seem to access those values;

    <?php
    // Declare the global $IN to get access to POST variables
    global $IN;
    //print_r( $IN );
    
    // Setup the post variables
    $start_on = $IN->GBL("start_on");
    $stop_before = $IN->GBL("stop_before");
    
    echo $start_on;
    echo " / ";
    echo $stop_before;
    ?>

    Any idea why? Would it have to do with me re-writing the URLs to remove the index.php? I can point the form at the actual URL if it would help (although it seems to have no effect)...

    Ta,

  • #6 / Jan 14, 2011 5:58am

    LucPestille

    146 posts

    Even using Brian Litzinger GET/POST Parameters plugin (http://ellislab.com/forums/viewthread/129463) nothing is returned - I’m beginning to suspect that it’s all down to the URL rewriting using LG’s .htacess generator. How can I bypass that for this URL (that the form is posted to), or change the action=”” URL to point to the actual URL (after working with removed index.php for so long, I forget what it should be!).

    Thanks,

  • #7 / Jan 20, 2011 5:20am

    LucPestille

    146 posts

    Anyone got any further ideas? Not being able to use a custom form to pull out EE weblog entries is now a major stumbling block…

  • #8 / Feb 04, 2011 12:52pm

    Derek Hogue

    316 posts

    Luc - this would be your problem:

    dateFormat: "yy-mm-dd"

    From the EE docs:

    The date/time must be specified in the following format:
    YYYY-MM-DD HH:MM

  • #9 / Feb 04, 2011 1:17pm

    LucPestille

    146 posts

    The datetimepicker automatically adds on the HH:MM format, but that wasn’t my problem in the end, I just couldn’t get the posted variables back out using EE native code, so I had to post the form to an intermediary .php script, redirect it to a new URL, and pull the dates out of segments. Not as elegant as I hoped, but it works now.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases