Form error htmlentities() expects parameter 1 to be string, array given and no line

余生长醉 提交于 2019-12-13 08:17:44

问题


If I change the error to simple HTML, the error is gone.

{{Form::open(array('url'=>'')) . "" }}
                    <div class="basic-form">

and it goes on: (cannot paste more code here)

                        <div class="hsb-input-1">
                            {{Form::text('user_query', array('class'=>'form-control', 'placeholder'=>'I\'m looking for qualified personnel in ...')) }}
                        </div>

                        <div class="hsb-text-1">Language</div>

                        <div class="hsb-container">

                            <div class="hsb-select">
                            {{Form::select('selection', 
                                ['all'=> 'Select all', 
                                'c' => 'C/C++/C#', 
                                'html' => 'HTML/CSS/Design', 
                                'java'=> 'Java', 
                                'javascript'=>'Javascript', 
                                'php'=>'PHP', 
                                'python'=>'Python', 
                                'ruby'=>'Ruby', 
                                'xml'=>'XML/XSLT/Xquery', 
                                'fortran'=>'Fortran', 
                                'vb'=>'VB', 
                                'sql'=>'SQL', 
                                'abap'=>'ABAP', 
                                'oc'=>OC, 
                                'swift'=>'SWIFT'], 
                                all,
                                ['class' => 'form-control']) 
                            }}
                            </div>
                        </div>

                        <div class="hsb-submit">
                            {{Form::submit('Submit', array('class' => 'btn btn-default btn-block', 'id' => 'submit'))}}
                            <!--<input type="submit" name="search" class="btn btn-default btn-block" value="Search"> -->
                        </div>
                    </div>

                {{Form::close()}}

What can I do to correct the error message? I think I have a mistake in the form.


回答1:


You use it in wrong way. The second argument for text is not array of options but value (reference) so instead of:

{{Form::text('user_query', array('class'=>'form-control', 'placeholder'=>'I\'m looking for qualified personnel in ...')) }}

it should be rather:

{{Form::text('user_query', null, array('class'=>'form-control', 'placeholder'=>'I\'m looking for qualified personnel in ...')) }}


来源:https://stackoverflow.com/questions/27203369/form-error-htmlentities-expects-parameter-1-to-be-string-array-given-and-no-l

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