dongtiandexue123456 2017-05-03 09:13
浏览 32
已采纳

Laravel约束错误

After I filled in the dropdown menu with a forloop using the data of the inner join query that had been made. Everything was shown in the dropdown menu as it should. (company_name - task title). But when I press on save, my ajax throws an error which I will paste below.

<td> <select class='project_id'>@foreach($query as $data)<option>{!!  $data->company_name !!} - {!! $data->title !!}</option>@endforeach</td>

is the piece of code I use to loop through the query and to post the values in the dropdown menu

The printscreen of a part of the query and the values is posted below: enter image description here The error I get when I press the save button is.

enter image description here

If I check the object that gets sent via my ajax request. I see this:

enter image description here

  • 写回答

2条回答 默认 最新

  • douhe6255 2017-05-03 09:24
    关注

    You are not submitting the actual project id with the request which is needed.

    Make sure the option value contains the project id and that is has the name set to project_id if that's what you are using on the server-side.

    <td> <select class="project_id" name="project_id">@foreach($query as $data)<option value="{{ $data->id }}">{!!  $data->company_name !!} - {!! $data->title !!}</option>@endforeach</td>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化