dongzhang8680
2016-05-12 13:34
浏览 85
已采纳

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

How do I get the value of these dynamically generated textarea? Normally in the controller it is possible to use request object to get the values of statically defined fields, doing thus: $request->fieldname since this is not the case, how do I get the value of such fields?

    @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条回答 默认 最新

  • dongqijuan3786 2016-05-14 19:19
    已采纳

    I'm not sure this is the best idea, but try this.

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

    and you have an array with dynamically added fields.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题