热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

需要一个好的方式让用户选择“to”发送电子邮件-Needagoodwayforusertoselect“To”foremailsending

Ihaveawebsitewhereausercansendoutemailsfrom.Ihavekindofmimicsbasicformwith:我有一个网

I have a website where a user can send out emails from. I have kind of mimics basic form with:

我有一个网站,用户可以从那里发送电子邮件。我模仿了一些基本的形式

To: 
Subject:
Attachments: 

I have a list of email address in a database table and it's easy for me to retrieve this. I am trying to find the slickest way to support the following use cases:

我在数据库表中有一个电子邮件地址列表,我很容易检索到它。我正试图找到最巧妙的方法来支持以下用例:

  1. Allow users to send email to everyone in list.
  2. 允许用户向列表中的每个人发送电子邮件。
  3. Allow users to select specific members of group
  4. 允许用户选择组的特定成员。

What would be a good way to do this? Do some code samples exist?

有什么好办法呢?是否存在一些代码示例?

One way I thought of is to mimic Gmail when you can just start typing and it will do an inline search for emails in the list. I guess I would have a separate button to "Select All" users in this case.

我想到的一种方法是模仿Gmail,当你可以开始输入时,它会对列表中的电子邮件进行内联搜索。我想在这种情况下,我会有一个单独的按钮来“选择所有”用户。

That is just one idea. I am open to suggestions.

这只是一个想法。我愿意接受建议。

3 个解决方案

#1


2  

The jQuery plugin I referenced in my answer below has been replaced by a jQuery UI component.

我在下面的回答中引用的jQuery插件已经被jQuery UI组件所取代。


I'd definitely recommend the autocomplete approach. Something like this jQuery plugin would be a good start. You'd need to modify the code to treat commas as a trigger for a new autocomplete search though.

我绝对推荐自动完成方法。类似jQuery插件的东西将是一个好的开始。您需要修改代码,将逗号作为新的自动完成搜索的触发器。

As for the all members, yup, an "All Members" checkbox seems the most straightforward. If you wanted, you could also include keyword triggers in your To field processing so that words like "All" or "Everyone" would be equivalent to selecting the checkbox.

对于所有的成员,yup,一个“所有成员”复选框似乎是最直接的。如果需要,还可以在To字段处理中包含关键字触发器,这样“All”或“Everyone”等词就相当于选择复选框。

Edit: jQuery is one step ahead of me and the autocomplete plugin already supports multiple entries:

编辑:jQuery领先我一步,自动补全插件已经支持多个条目:

$("#suggest3").autocomplete(cities, {
    multiple: true,
    mustMatch: true,
    autoFill: true
});

#2


1  

How 'bout a simple select list. All Group1 Group2 Group3 ...

如何选择一个简单的选择列表。第一组第三组…

If a group is selected, load a multiple select with the group members in it.

如果选择了一个组,则在其中装入多个select。

#3


1  

I'd make 'send to all' just a checkbox, and the server determines that list (so it's not displayed client side).

我将'send to all'设置为一个复选框,服务器将确定该列表(因此它不显示客户端)。

With specific users, I'd allow the person who choose ID's from a list (not actual email addresses). If it's not mail client, you probably shouldn't be listen these peoples' emails publically. How you present this depends on how many people are in your database, etc. But autocomplete may be nice, or a simple tree-based selection. (Listing groups > people).

对于特定的用户,我允许从列表中选择ID的人(而不是实际的电子邮件地址)。如果不是邮件客户,你可能不应该公开地听这些人的电子邮件。如何呈现这取决于数据库中有多少人,等等,但是自动完成可能很好,或者是一个简单的基于树的选择。(清单人群>)。


推荐阅读
author-avatar
ha遗忘的密
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有