微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Drupal 6/jQuery Ajax更新字段

我在同一个站点上的路径不同,我需要允许用户更改他/她在不同位置写入的节点上的字段内容.我有nodeid和字段名称,以及ids等np.

我不相信这太难了,但教程或解释会很精彩.

谢谢.

编辑:谢谢anschauung的询问,所以澄清一下:

这是CCK textarea.至于为什么,有一个中心节点类型,有许多链接节点参考节点.从引用中心节点的任何节点的编辑页面,它需要能够编辑和保存中心节点的字段.这就是我的用例.

再次感谢.

非常感谢googletorp,我非常感谢你的帮助.

这是我到目前为止所拥有的:

对于第一步:

function update_main_field_menu() {

  $items = array();

  $items['update_main_field/%'] = array(
    'title' => 'Update Main Field','page callback' => 'post_to_main_node','page arguments' => 1,'type' => MENU_CALLBACK
  );

  return $items;
}

第二步:

function post_to_main_node(){
    // Sorry,I'm totally lost. What do I put here?
}

你也提到了这个:

Either in hook_form_alter,
hook_nodeapi or some other hook that
is invoked when the node form is
generated. You should investigate
which is best in your situation.

如何生成节点表单?

第三步:

function modulename_form_mainct???_node_form_alter (&$form,&$form_state) {

    // I'm not sure about which form I'm doing node form alter on. If I do it to the mainct,wouldn't that alter the regular edit page the user is viewing? I only want to load the js for the ajax submission. Is there a update_main_field node form?


    drupal_add_js(drupal_get_path('module','modulename') ."/updateField.js");
}

此外,步骤2中的功能与步骤3中的节点形式之间的区别是什么?

步骤4:
我想我大部分都理解,但由于其他事情,我还无法测试它.

原文地址:https://www.jb51.cc/jquery/181379.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐