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 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器