rsanchez / dynamo

Makes Dynamic Parameters behave more like the Search module.
http://devot-ee.com/add-ons/dynamo/
10 stars 2 forks source link

Dynamo checked and selected issues #7

Closed dehuszar closed 11 years ago

dehuszar commented 12 years ago

I'm having trouble getting the selected states to stay put between submissions.

My code:

{exp:dynamo:form return="reports/applications" search_id="{segment_3}"}             
                        <fieldset>
                                <label>Availability Type<br />
                                    <select name="application_availability_type">
                                            <option value="Days"{if application_availability_type == "Days"} selected="selected"{/if}>Days</option>
                                        <option value="Nights"{if application_availability_type == "Nights"} selected="selected"{/if}>Nights</option>
                                        <option value="Weekends"{if application_availability_type == "Weekends"} selected="selected"{/if}>Weekends</option>
                                        <option value="Full-Time"{if application_availability_type == "Full-Time"} selected="selected"{/if}>Full-Time</option>
                                        <option value="Part-Time"{if application_availability_type == "Part-Time"} selected="selected"{/if}>Part-Time</option>
                                        <option value="Temporary"{if application_availability_type == "Temporary"} selected="selected"{/if}>Temporary</option>
                                    </select>
                                </label>
                        </fieldset>
                        <fieldset>
                                <label>
                                    Level of Education<br />
                                    <label class="checkbox"><input type="checkbox" name="search:application_education_level" value="H.S. / GED"{if application_education_level == "H.S. / GED"} checked="checked"{/if} />H.S. / GED</label>
                                    <label class="checkbox"><input type="checkbox" name="search:application_education_level" value="Associates"{if application_education_level == "Associates"} checked="checked"{/if} />Associates</label>
                                    <label class="checkbox"><input type="checkbox" name="search:application_education_level" value="Bachelors"{if application_education_level == "Bachelors"} checked="checked"{/if} />Bachelors</label>
                                    <label class="checkbox"><input type="checkbox" name="search:application_education_level" value="Advanced"{if application_education_level == "Advanced"} checked="checked"{/if} />Advanced</label>
                                </label>
                        </fieldset>
                        <fieldset>
                                <label>
                                    Entries to Display<br />
                                    <select name="limit">
                                        <option value="10"{if limit == 10} selected="selected"{/if}>10</option>
                                        <option value="20"{if limit == 20} selected="selected"{/if}>20</option>
                                        <option value="50"{if limit == 50} selected="selected"{/if}>50</option>
                                        <option value=""{if limit == ""} selected="selected"{/if}>All</option>
                                    </select>
                                </label>
                                <label>
                                    Has Union Card<br />
                                    <label class="checkbox"><input type="checkbox" name="search:application_union_card" value="yes"{if application_union_card == "yes"} checked="checked"{/if} />yes</label>
                                </label>
        </fieldset>
    <input type="submit" value="SUBMIT">
{/exp:dynamo:form}
dehuszar commented 12 years ago

Sorry, hit submit too quickly. Anything above look out of place? I am expecting to see the checkboxes stay checked and selected items stay selected. The application_availability_type field appears to be staying put, but not filtering, and the remaining checkboxes are filtering, but their checked status isn't displaying.

Any help would be appreciated.

ghost commented 12 years ago

Were you able to fix this?

rsanchez commented 12 years ago

Your tags/conditionals should have the search: prefix to work, just like the form input name.

dehuszar commented 12 years ago

I'll give that a try, thanks!

ghost commented 12 years ago

Can you give an example please?

ghost commented 12 years ago

Ok nevermind i got it to work thanks :)

ghost commented 12 years ago

Ok still trying things out so with a P&T radio selection it workes with the following code <input type="radio" name="search:fieldname" class="filter-input" value="field_value" {if search:fieldname == "field_value"} checked="checked"{/if}> This works.

But once i change the radio into checkbox it only remember one checkbox instead of multiple after submit

also .. if the field come from matrix there is no way around it ?

rsanchez commented 12 years ago

EE search: params don't natively support Matrix fields, so there's not much I can do there. With regard to multi-checkboxes/multiselects, there's no solution for that yet, I have to think about a suitable solution.

ghost commented 12 years ago

With the help of pixelandtonic i was able to submit multiple values for search for matrix fields. http://jsfiddle.net/brandonkelly/XPDVp/1/

The problem i'm facing now is "holding" on to the submitted value to keep my "checkbox" checked after submission

now it disappear after submission, so the user doesn't know what they checked. It is not only for "matrix" but even for P&T unless i'm doing something wrong here as it works for radio buttons perfectly!

Original Question in pixelandtonic: https://getsatisfaction.com/pixelandtonic/topics/filter_enteries_with_matrix_field_rows_with_checkboxes?utm_content=topic_link&utm_medium=email&utm_source=reply_notification