随着定制字段的到来在Joomla,现在可以创建更强大的联系形式。

我们通过创建一个Joomla联系表单的基本知识,然后来了解如何添加字段。

本教程中的例子是从“Joomla 3解释“即将到来的新版本,最畅销的Joomla的书。

如何创建一个Joomla联系形式

在Joomla 3解释说,我们城市建立一个网站叫“Joomlaville”,这就是我们使用的命名体系解释道。

  • 去“组件”,然后“联系人”。
  • 点击 "新建"。
  • 名称:Joomlaville Mayor
  • 电子邮件:电子邮件字段中输入您的电子邮件地址。这封邮件不会被公开,但每当有人使用接触形式,电子邮件发送到这个地址。
  • 类别:Joomlaville Contacts ,然后单击“输入”或“回车”在你的键盘。

new joomla contact form category

当所有三个字段都填写,您的屏幕应该类似于下面的一个。

new joomla contact form

我们也要做一个小选择改变。这是一个设计更改,因为我个人认为另一个布局是易于阅读比默认联系人布局:

  • 单击“显示”选项卡。   
  • 将“显示格式”选项设置为“普通”,如下图所示。

joomla contact form display options

Now that you have your contact form ready, the final step is to make it publicly visible via a menu link. Because we already have a Contact Us menu link, we’re going to edit that instead of adding a new link.

  • Go to "Menus, "Main Menu", then "Add New Menu Item".
  • Title: Contact 
  • Menu Item Type: Single Contact
  • Select Contact: Joomlaville Mayor

joomla contact form menu link

Now visit the front of your site, and your contact form will look like the image below:

completed joomla contact form

If anyone uses this form, you will now get an email that looks like this:

joomla contact form email

How to Use Administrator Fields

There are some useful features you can use to improve your form. For example, you can add more data about your organization:

  • Go to "Components", then "Contacts" and edit "Joomlaville Mayor".
  • You will see a variety of contact fields including Address, City or Suburb, State or Province, Telephone, and Website. The image below shows some sample data from OSTraining:

joomla contact form admin fields

Here's how that data will appear on the front of the site:

joomla contact form with admin fields

How to Add User Fields to Your Contact Form

You can also create custom fields to improve this contact form. 

  • Go to "Components" and "Contacts".
  • Click "Field Groups" in the left-hand sidebar.
  • This is the important new task: choose "Mail" from the dropdown menu. This means your fields will be attached to contact forms that users can rely on to send email. If we choose "Contact" or "Category", our fields will only be available to site administrators. If you choose "Contact", this will be similar to the Address, City or Suburb, etc fields we saw above.

new field group joomla contact forms

  • Click "New".
  • Title: Extra Contact Details
  • Save the field group and make sure your next screen looks like this:

new field group joomla contact forms saved

  • Click "Fields" in the left-hand sidebar.
  • Again, choose "Mail" in the dropdown menu:

new joomla contact form field

  • Click "New".
  • Title: What is Your Question About?
  • Type: Checkboxes

new joomla contact form field setting

  • Field Group: Extra Contact Details
  • Checkbox Values: Enter topics that people might be contacting you about.

new joomla contact form field values

  • Click the "Permissions" tab.
  • Set "Edit Custom Field Value" to "Allowed". This will allow anyone to enter data into this field.

new joomla contact form field permissions

  • Visit the front of your site and your contact form will now have a custom field:

new joomla contact form field display

These custom fields will be included the emails you receive:

new joomla contact form field email

All-in-all, there are 15 field types in Joomla. With these fields, you can create some powerful contact forms.