获取Laravel控制器中动态生成的textarea的值

时间:2016-05-12 13:34:30

标签: php dynamic laravel-5.1 laravel-blade

如何获取这些动态生成的textarea的值?通常在控制器中,可以使用请求对象来获取静态定义字段的值,这样做:$request->fieldname因为不是这种情况,我如何获得这些字段的值?

    @foreach($splitProcedure as $procedureSelected)

    {!! Form::hidden($trimWhitepsace = preg_replace('/[^A-Za-z0-9]/', "", $procedureSelected)) !!}
        <TH>{!! $procedureSelected !!}</TH>
        <TH>DESCRIPTION</TH>
        <TR>
            <TD class="col-xs-12 col-md-6">
                <div>
                    <p>You have used <span class="css-button" id="counter2"></span> words. </p>
                    {!! Form::textarea($trimWhitepsace .'desc',
                              Input::old($trimWhitepsace .'desc'),
                              [
                               'class' => 'mid first-input-div',
                               'placeholder' => 'Please, within 200-250 characters describe what the company is about',
                               'id' => $trimWhitepsace .'desc'
                              ])
                    !!}
                    {!! Form::hidden('hiddenDescription', $trimWhitepsace .'desc') !!}
                </div>
            </TD>
            <TD class="col-xs-12 col-md-6">
                <div>
                    {!! Form::text($trimWhitepsace,
                              Input::old($trimWhitepsace),
                              [
                               'class' => 'mid first-input-div',
                               'placeholder' => 'enter price',
                               'id' => $trimWhitepsace
                              ])
                    !!}
                    {!! Form::hidden('hiddenPrice', $trimWhitepsace .'price') !!}
                </div>
            </TD>
            <TD></TD>
        </TR>
    @endforeach

1 个答案:

答案 0 :(得分:1)

我不确定这是最好的主意,但试试这个。

$dynamic_fields = array_except($request->all(), ['_token', 'static_field1','static_field2'...]);

你有一个动态添加字段的数组。