drupal通过服务保存POST

时间:2019-05-13 11:07:46

标签: drupal drupal-7 drupal-services

我正在尝试通过服务模块中的api保存节点。我在保存多个复选框值时遇到了麻烦。

查看通过浏览器提交的表单发送的内容时,多个复选框如下所示:

[und][20-25] = 20-25

我正在这样复制我的api的save方法:

foreach($range as $sf) {
    $newNode->field_salary_filter['und'][$sf] = $sf;
    $j++;
}

循环基本上是遍历由内插逗号分隔的字符串(这是选中复选框的方式)所组成的值的数组。

但是此行似乎导致此错误:

  

PDOException:SQLSTATE [01000]:警告:1265第4行的“ delta”列的数据被截断了:INSERT INTO {field_data_field_salary_filter}(entity_type,entity_id,revision_id,bundle,delta,语言,field_salary_filter_value)VALUES(:db_insert_placeholder_0,: db_insert_placeholder_1,:db_insert_placeholder_2,:db_insert_placeholder_3,:db_insert_placeholder_4,:db_insert_placeholder_5,:db_insert_placeholder_6),(:db_insert_placeholder_7,:db_insert_placeholder_8,:db_insert_placeholder_9,:db_insert_placeholder_10,:db_insert_placeholder_11,:db_insert_placeholder_12,:db_insert_placeholder_13),(:db_insert_placeholder_14,:db_insert_placeholder_15,:db_insert_placeholder_16 ,:db_insert_placeholder_17,:db_insert_placeholder_18,:db_insert_placeholder_19,:db_insert_placeholder_20),(:db_insert_placeholder_21,:db_insert_placeholder_22,:db_insert_placeholder_23,:db_insert_placeholder_24,:db_insert_holder,24;:db_insert_holder; 24::db_insert_holder数组([:db_insert_placeholder_0] =>节点[:db_insert_placeholder_1] => 900 [:db_insert_placeholder_2] => 900 [:db_insert_placeholder_3] =>作业[:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_1] [:db_insert_placeholder_7] =>节点[:db_insert_placeholder_8] => 900 [:db_insert_placeholder_9] => 900 [:db_insert_placeholder_10] =>作业[:db_insert_placeholder_11] => 1 [:db_insert_placeholder_12] => und [:db_ins_13 db_insert_placeholder_14] =>节点[:db_insert_placeholder_15] => 900 [:db_insert_placeholder_16] => 900 [:db_insert_placeholder_17] =>作业[:db_insert_placeholder_18] => 2 [:db_insert_placeholder_19] => und [:db_insert_holder] =>节点[:db_insert_placeholder_22] => 900 [:db_insert_placeholder_23] => 900 [:db_insert_placeholder_24] =>作业[:db_insert_placeholder_25] => 10-20 [:db_insert_placeholder_26] => und [:db_insert_placerage_27] => sto in rite()

任何人都可以阐明问题或我如何通过POST和我的api保存多个复选框的值吗?

0 个答案:

没有答案