简体   繁体   中英

Ordered list with hidden inputs

I have such code form in my webapp ( http://jsfiddle.net/eavjd5dd/ ) but when I send a listed item the order is as it was at the default situation.

so my question is why does the new order of the hidden values are not taken in consideration in the server side...? Is there another function to call to apply the ordering of the ordered list...?

Thanks for the help guys :)

<style>
    #sortable{
        -margin-left: 0;
        padding-left: 0.5;
        list-style-type:;
    }
    .ui-state-highlight{
        padding: 2px;
        margin: 2px;
        border: 1px dashed black;
        height: 20px;
    }
</style>
<script>$(function(){
$("#sortable").sortable({axis: "y", placeholder: "ui-state-highlight"});
});
<script>
    <form name="categoriesManagement" method="post" action="categoriesManagement.jsp">


            <div class="col-sm-6 col-md-6">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4>List of categories</h4>
                    </div>
                    <div class="panel-body">
                        <ol id="sortable" class="ui-sortable">

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="9">

                                        blabla
                                        1

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="10">

                                        blabla
                                        2

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="11">

                                        blabla
                                        3

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="12">

                                        blabla
                                        4

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="13">

                                        blabla
                                        5

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="404">

                                        blabla
                                        6

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="14">

                                        blabla
                                        7

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="15">

                                        blabla
                                        8

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="17">

                                        blabla
                                        9

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="16">

                                        blabla
                                        10

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="19">

                                        blabla
                                        11

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="18">

                                        blabla
                                        12

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="21">

                                        blabla
                                        13

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="20">

                                        blabla
                                        14

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="23">

                                        blabla
                                        15

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="22">

                                        blabla
                                        16

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="25">

                                        blabla
                                        17

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="24">

                                        blabla
                                        18

                                </li>

                                <li>
                                    <input type="hidden" name="categoryOrdering" value="26">

                                        blabla
                                        19

                                </li>

                        </ol>
                    </div>
                    <div class="panel-footer text-right">
                        <input type="submit" value="SAVE_CATEGORY_POSITIONING" class="showToolTipTop" title="" data-original-title="Save positioning of categories.">
                    </div>
                </div>
            </div>
        </form>

Thanks a lot my friend the collection was the problem. I effectively converted my array of string into an array of long[] and it worked well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM