我使用的是Drupal 6自定义表单,我想将表单名称属性更改为其他内容。这可能吗?
例如,我有这个。
<input type="text" name="field" maxlength="128" id="edit-name" value="">
我想将其更改为以下内容。
<input type="text" data-name="field" maxlength="128" id="edit-name" value="">
答案 0 :(得分:0)
You can add the new attribute by using hook_form_alter() and adding a #data-name
to the array for the field you are trying to update. I don't think you can easily remove the name attribute in Drupal 6, but I've never tried. More on the Drupal 6 Form API.
Take Note: Drupal 6 is no longer officially supported by the community. While there are some places that are offering long term support for Drupal 6, you should plan to move to Drupal 7 or 8 soon.