处理表单必填字段

时间:2015-09-18 12:46:27

标签: php jquery mysql forms input

我无法弄清楚如何编辑此代码以使所有cotegories(dropdown-list-fields)成为必填字段。此脚本仅在处理之前验证最多2个下拉列表字段,并且我最多有4个类别dropdown-list-fields。有什么想法吗?

<!-- category select -->
            <div class="form-group">
                <div class="col-md-12">
                    <?= FORM::label('category', __('Category'), array('for'=>'category'))?>
                    <div id="category-chained" class="row <?=($id_category === NULL) ? NULL : 'hidden'?>"
                        data-apiurl="<?=Route::url('api', array('version'=>'v1', 'format'=>'json', 'controller'=>'categories'))?>"
                        data-price0="<?=i18n::money_format(0)?>"
                        <?=(core::config('advertisement.parent_category')) ? 'data-isparent' : NULL?>
                    >
                        <div id="select-category-template" class="col-md-5 hidden">
                            <select class="disable-chosen select-category" placeholder="<?=__('Pick a category...')?>"></select>
                        </div>
                        <div id="paid-category" class="col-md-12 hidden">
                            <span class="help-block" data-title="<?=__('Category %s is a paid category: %d')?>"><span class="text-warning"></span></span>
                        </div>
                    </div>
                    <?if($id_category !== NULL):?>
                        <div id="category-edit" class="row">
                            <div class="col-md-8">
                                <div class="input-group">
                                    <input class="form-control" type="text" placeholder="<?=$selected_category->name?>" disabled>
                                    <span class="input-group-btn">
                                        <button class="btn btn-default" type="button"><?=__('Select another')?></button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    <?endif?>
                    <input id="category-selected" name="category" value="<?=$id_category?>" class="form-control invisible" style="height: 0; padding:0; width:1px; border:0;" required></input>
                </div>
            </div>

0 个答案:

没有答案