• Resolved agustynen

    (@agustynen)


    <div style="margin: 0 0 30px 15px;"><form id="mla-text-form" class="row" action="." method="post">
    <h4><strong>Type document</strong></h4>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" include=219,405,197 ]
    <h4><strong>Meubellijn</strong></h4>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" child_of=941 ]
    <div class="fusion-button-wrapper"><input id="text-form-submit" class="fusion-button button-flat fusion-button-square button-xlarge button-default button-1" name="text_form_submit" type="submit" value="Toon selectie" /></div>
    </form></div>

    The above is my selection part. How do is set a cookie to remeber the selection after submit? I already spent 2 days and nothing seems to work. I see current_item and $_COOKIE but it’s not clear how to use them.

    • This topic was modified 7 years, 7 months ago by agustynen.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for including the source text from your application. Making the dropdown selections “sticky” when the form is submitted has come up before. It is one of the motivating factors behind the “MLA UI Elements Example” plugin developed for these earlier topics:

    How do I provide a front-end search of my media items using Custom Fields?

    Dynamic search and filters

    Very new to this, need help

    Limiting search results to attachment tags/’Justifying’ gallery grids

    Shortcode

    To install the example plugin, navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. You will see a taable that lists all the example plugins and give you a “one-click” action for installing them. Type “ui” in the text box and click “Search Plugins” to filter the table.
    You are looking for “MLA UI Elements Example” plugin. Find that plugin and hover over the title in the left-most column. Click the “Install” rollover action, then go to the WordPress Plugins/Installed Plugins submenu and activate it as you would any other plugin.

    You can also click the “View” rollover action to look at the source code, which begins with a page of comments listing the functions provided by the plugin. For your specific application the “use_filters=true” will be useful.

    Your application has two dropdown controls; you must give each one a distinct name so the selection in each one can be set accurately. The mla_control_name parameter is provided for this purpose. Here is an earlier topic with multiple dropdown controls and a gallery display:

    Pagination broken

    You only included the input form in your post so I can’t give you a complete solution, but here is what your form would look like to make use of the example plugin:

    <div style="margin: 0 0 30px 15px;">
      <form id="mla-text-form" class="row" action="." method="post">
        <h4><strong>Type document</strong></h4>
        [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" include=219,405,197 mla_control_name=dropdown1 use_filters=true]
        <h4><strong>Meubellijn</strong></h4>
        [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" child_of=941  mla_control_name=dropdown2 use_filters=true]
        <div class="fusion-button-wrapper">
          <input id="text-form-submit" class="fusion-button button-flat fusion-button-square button-xlarge button-default button-1" name="text_form_submit" type="submit" value="Toon selectie" />
        </div>
      </form>
    </div>
    

    I hope that gets you started on a solution for your application. I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions. I believe you will find that combining the example plugin with the shortcodes has many possibilities. Thanks for your interest in the plugin.

    Thread Starter agustynen

    (@agustynen)

    YOU ARE MY HERO !!!

    Really, you are. ? ? ?

    <div style="margin: 0 0 30px 15px;"><form id="mla-text-form" class="row" action="." method="post">
    <h4><strong>Type document : </strong></h4>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" include=1978,219,405,197 order=ASC use_filters=true mla_control_name=docvisitor mla_item_parameter=docvisitor]
    <h4><strong>Meubellijn : </strong></h4>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" child_of=941 use_filters=true mla_control_name=meubelvisitor mla_item_parameter=meubelvisitor ]
    
    <span style="color: #ffffff;">---</span>
    <div class="fusion-button-wrapper"><input id="text-form-submit" class="fusion-button button-flat fusion-button-square button-xlarge button-default button-1" name="text_form_submit" type="submit" value="Toon selectie" /></div>
    </form></div>

    Yes, it’s the cookie i was looking for. I really hope this code publishing helps future people.

    • This reply was modified 7 years, 7 months ago by agustynen.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘keep selected dropdown value after submit (cookie, local storage ???)’ is closed to new replies.