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, fancybox, safecracker problem

January 25, 2012 1:09am

Subscribe [1]
  • #1 / Jan 25, 2012 1:09am

    Ralph Bartsch

    31 posts

    Hi,
    To manage a list of about 800 entries i use a form with droplists to filter out various custom fields, including two custom dates. Using expressionengines dynamic_parameters with Date Field this works quite well.

    {exp:channel:entries
        channel="jobb_ticket"
        search:display="published|updated|delivered" 
        status="Open|Closed" 
        limit="9999"
        dynamic_parameters="search:namn|search:produkt|search:kund|search:producent|search:materialdag|search:utgivningsdag" 
        orderby="materialdag|utgivningsdag" 
        date_field="materialdag"
           date_field_start="<? if(!empty($_POST['startdate'])){echo date('Y-m-d H:i', $_POST['startdate']);} ?>"
           date_field_stop="<? if(!empty($_POST['startdate'])){echo date('Y-m-d H:i', $_POST['startdate'] + 604799);} ?>"
           sort="asc|asc"
          }
       {exp:tally:add 
        collection="summa_media" 
        value="{mediakop}" 
        count="{count}"
       }

    The filtered list contains after each row a submit button, to be able to edit some of the custom fields, linked to a fancybox containing a safecracker form.

    <div class="col_btn_registrera"><a class="registrera_produkt fancybox.ajax" href="{site_url}client/client_register_ajax/index_thewineagency/{entry_id}"><input type="submit" name="" value="Registrera" /></a></div>
    $('.registrera_produkt').fancybox({
        Width  : 340,
        Height  : 100,
        autoDimensions : false
       });
    <html>
    <head>
    [removed]
            $(document).ready(function(){
                    $('#publishForm').ajaxForm({
                            dataType: 'json',
                            success: function(data) {
                                    if (data.success) {                                                                   
                                    } else {
                                            alert('Failed with the following errors: '+data.errors.join(', '));
                                    }
                            }
                    });
            });
            $('#publishForm').submit(function(){
             $.fancybox.close();
             $(parent.document)[0].location.reload(true);
             return false;
            });
    [removed]
    <link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen">
    <link href="{site_url}css/gridlocker.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    {exp:safecracker include_jquery="no" channel="jobb_ticket" entry_id="{last_segment}"}
    <input type="hidden" id="display" name="display" value="updated" >
    <input type="hidden" id="status" name="status" value="open" >
    <input type="text" name="produkt" id="produkt" value="{produkt}">br>
    <input type=text name="mediakop" id="mediakop" value="{mediakop}">br>
    <input type="submit" name="submit_button" id="submit_button" value="Uppdatera">
    {/exp:safecracker}
    </body>
    </html>

    It does not matter if i use the basic safecracker form or the ajax driven, after submit is always redirected to unfiltered list.
    Using the ajax driven form i can close the fancybox to an unupdated list or an updated but unfiltered list.
    Using the standard form always redirects to the unfiltered list.

    How do i redirect the user to the last filtered, now updated list? or how do i refilter the list for him using the last search?
    How do i get this to work, please help!

    thanks
    Ralph

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

ExpressionEngine News!

#eecms, #events, #releases