使用 Jquery / Javascript 插入表单大括号别名

发布于 2024-12-24 03:48:42 字数 553 浏览 4 评论 0原文

我什至不确定这是否可能或有多容易,但我正在尝试解决的是,如果可能的话,如何使用 jquery 或 javascript 为表单字段/大括号插入别名,其中当前光标在页面上处于选中状态。

让我尝试更好地解释一下......

所以我转到电子邮件模板表单,在表单的右侧我有3个按钮,

NAME , REP , DATE
Name = {leadname}
Business Name = {businessname}
Date = {datesent}

这些都是被发布到 $form-> 中的表单字段。加载时的数据数组。

我开始写我的模板......亲爱的{leadname}等 发送模板时,它将客户名称等加载到大括号中并通过电子邮件发送。

我想做的是这样做,这样某人就不会为人名写 Leadname ,而是按下标记为 'Name' 的表单右侧的按钮,然后将 [Name] 或粗体的 Name 插入表单中,但是这实际上是 {leadname} 的别名,所以我不确定是否也必须更改我的语言文件才能使其正常工作?我也不确定如何将这些字段实际插入到我的模板表单字段中。

I am not even sure if this is even possible or how easy it is, but what I am trying to work out is how to, if it is possible, to use jquery or javascript to insert an alias for a form field / curly brackets where the cursor currently is selected on the page.

Let me try and explain it a bit better.......

So I go to the email template form, on the right of the form I have 3 buttons,

NAME , REP , DATE
Name = {leadname}
Business Name = {businessname}
Date = {datesent}

These are all form fields being posted into the $form->data array when it loads.

I start writing out my template so.......Dear {leadname} etc etc
when the template is sent, it loads the clients name etc into the curly brackets and sends it in an email.

What I am trying to do is make this so that someone doesnt write leadname for the persons name but presses the button to the right of the form marked 'Name' , this then inserts [Name] or maybe Name in bold into the form, but this is actually an alias of {leadname} , so im not sure if I have to change my language file too to get this to work ?, im also not sure how to actually insert these fields into my template form field.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以笙箫默 2024-12-31 03:48:42

这就是你所说的做的事情吗?
http://alexking.org/projects/js-quicktags/demo/index.html html

如果是这样,我认为这个 JavaScript 快速标签的实现会让你继续前进:
http://alexking.org/blog/2004/06 /03/js-quicktags-under-lgpl/

否则,这篇文章可能会帮助您:在光标使用 Javascript/jquery 的位置插入文本

-

编辑

这是您需要的代码,使用 Alex King 的插件创建一个不会关闭的按钮:

edButtons.push(
    new edButton(
        'leader_name'
        ,'LEADER'
        ,'{leadname}'
        ,-1
        ,-1
    )
);

Is this kind of what you're talking about doing?
http://alexking.org/projects/js-quicktags/demo/index.html

If so, I think this guys implementation of JavaScript quick tags will get you going:
http://alexking.org/blog/2004/06/03/js-quicktags-under-lgpl/

Otherwise, this post may help you out: Inserting a text where cursor is using Javascript/jquery

-

Edit

Here's the code you need, using Alex King's plugin to create a button that doesn't get closed:

edButtons.push(
    new edButton(
        'leader_name'
        ,'LEADER'
        ,'{leadname}'
        ,-1
        ,-1
    )
);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文