Filed values changes unexpectedly using checkbox

假如想象 提交于 2019-12-02 08:53:50

问题


I have multiple checkbox and their field name but i dont know where i have done wrong the name of the field changes i am unable to find out where is the problem.

Here my screen shot when checkbox values were fine:here is fine fields working good

And this here is screen shot there is multiple questions marks like ???? and these becoming annoying this fields value are with ???? there should not any question marks in this field

And my form where these checkboxes value are:

                  <form id="preferences_form" role="form" method="POST" novalidate action="{{ url('/preference') }}" class="mujucet-registration">
                            {{ csrf_field() }}
                            <h5>Nastavení zpráv</h5>
                            <div class="row">
                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label  for="ch1">
                                            <input type="checkbox" name="monthly" value="1" id="ch1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>Mesícní výpisy
                                        </label>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label >
                                            <input type="checkbox" name="weekly" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>Týdenní prehled
                                        </label>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="tax_reviews" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>Danové výpisy
                                        </label>
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="quarterly" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>Ctvrtletní výpisy
                                        </label>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="annually" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>Rocní výpisy
                                        </label>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="newsletter" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>Novinky
                                        </label>
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <div class="checkbox">
                                        <label class="border">
                                            <input type="checkbox" name="direct_mail_reviews" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span> Chci výpisy zasílat také Poštou <span class="light">20 kc za výpis</span>
                                        </label>
                                    </div>
                                </div>

                            </div><h5>Kontaktní preference</h5>
                            <div class="row">
                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="email" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>Email
                                        </label>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="sms" value="1"><span class="cr"><i class="cr-icon fa fa-check"></i></span>SMS
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </form>                    </div>

I dont how my checkboxes value goes weird here your help will be highly appreciated!


回答1:


For me it looks like encoding problem. Make sure that you use same view in both cases, and in both cases you have same encoding (I assume UTF-8):

<meta charset="utf-8">

in <head> section of your HTML.

Also make sure the file is saved in same encoding as you declared above.



来源:https://stackoverflow.com/questions/52580435/filed-values-changes-unexpectedly-using-checkbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!