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

获取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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程