ivaynberg / wicket-select2

Provides integration between Apache Wicket and Select2
64 stars 50 forks source link

Form validation in select2 and wicket #118

Open hellerEkc opened 4 years ago

hellerEkc commented 4 years ago

Hi, I tried to add atributte required to field with select2, but it doesnt work. Can you please tell me, how to do form validation with select2. Thanks for help. Validation which I want to do is originCountry.

<wicket:head xmlns:wicket="http://wicket.apache.org/">
    <style>
       /*.form-group .form-control {*/
       /*     padding: 0;*/
       /*     height: 33px;*/
       /* }*/

        .p-0 {
            padding: 0px !important;
            height: 30px;
        }
    </style>

</wicket:head>
<wicket:panel xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/">
    <div class="col-xs-12">
        <div class="col-xs-12">
            <div class="form-group">
                <div class="col-sm-3">
                    <input type="submit" value="Request" class="btn btn-danger"/>
                </div>

                <div class="col-sm-3">
                    <label for="quotationId" wicket:id="quotationIdLabel"></label>
                    <div>
                        <input wicket:id="quotationId" type="text" size="20"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="product" wicket:id="productLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="product"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="contract" wicket:id="contractLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="contract"/>
                    </div>
                </div>

                <div class="col-sm-3" style="padding: 0">
                    <label for="customer" wicket:id="customerLabel"></label>
                    <div>
                        <input class="form-control p-0" type="hidden"
                               wicket:id="customer" />
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="serviceLevel" wicket:id="serviceLevelLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="serviceLevel"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="equipmentType" wicket:id="equipmentTypeLabel"></label>
                    <div>
                        <input class="form-control p-0" type="hidden" wicket:id="equipmentType"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="commodity" wicket:id="commodityLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="commodity"/>
                    </div>
                </div>

                <span class="col-sm-3">
                    <label for="originCountry" wicket:id="originCountryLabel"></label>
                    <div>
                       <input type="hidden"  wicket:id="originCountry"  required/>
                    </div>
                </span>

                <div class="col-sm-3">
                    <label for="originDgfStation" wicket:id="originDgfStationLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="originDgfStation"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="destinationCountry" wicket:id="destinationCountryLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="destinationCountry"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="destinationDgfStation" wicket:id="destinationDgfStationLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="destinationDgfStation"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="shippingTerms" wicket:id="shippingTermsLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="shippingTerms"/>
                    </div>
                </div>

            </div>

            <br/>
        </div>
    </div>

    <div class="clearfix"></div>

</wicket:panel>
hellerEkc commented 4 years ago

@ivaynberg can U please help me with this issue?