HI guys I'm building a web mail client interface and would like an autosuggest script that could be used in filling out the recipient addresses. I've checked a few scripts but they limit by either allowing to choose only one element, or you can enter only elements from the drop down list - I just need one which not only allows you to add multiple selections but you can also type in and add values that are not included within the selection as well.
Oh it has to be prototype based. Thanks!
Script.aculo.us has autocomplete and is based on Prototype.
I've also like this one with and without scriptaculous.
Related
I've been experimenting with Symfony forms for some time. Without a doubt Symfony's FormType is a great feature which help create robust forms, especially with related entities (eg. ManyToMany, OneToMany etc.). The FormType makes my job a lot less complicated and easy when it comes to persistence. One of these case is the embedded forms, where u have multiple(lets say Category and Tag) entities with ManyToMany relation. Using FormType, I can create a 'Select dropdown' field using ChoiceType form field to choose category from, embed another CollectionType field with multiple 'text input' fields to accept multiple tagname, and finally a submit button. All I need is to add the cascade = {persist} option using annotations on the categoryname property of the Category entity and Wallah!
Now what if I wanted to create a single input field which can accept multiple tags, instead of having multiple input fields. Like this:
To do this I can create an <input> element using CollectionType form field, and then in my html.twig I can insert the javascript(jquery/AngularJS) dependency as attributes.
This can be done by using jquery Chosen or Select2 https://www.sitepoint.com/jquery-select-box-components-chosen-vs-select2/
or by using AngularJS ngTagsInput component http://mbenford.github.io/ngTagsInput/
Not just this particular case, I know that jquery delivers almost everything u want to do on the client side, and works good with Symfony, but I've been looking into AngularJS for some time now and it is undoubtedly true that it is further a step ahead of jquery or any other javascript framework. Thus my opinion is a little biased towards AngularJS.
The thing is, jquery(Chosen/Select2) uses <select> element and the AngularJS(ngTagsInput) uses custom <tags-input> element to display this field. Although with AngularJS I can make some elementary changes and convert the <tags-input> element to <div ngTagsInput> but I can't convert it to <input ngTagsInput> because the standard HTML<input> element has no closing tag, thus many features like auto-complete don't work. Customizing ngTagsInput & autoComplete directives (AngularJS)
Problem: For Symfony to persist the CollectionType field input in the standard way I need to use the <input> element to display the field.
Questions:
How do I make this work?
How compatible are Symfony and AngularJS? And is it recommended to use them together?
All help is appreciated.
Thanks in advance!
Hi awesome developers,
Maybe someone can help or put me in the right direction. I want to create a settings page with a few yes/no options.
These settings need to enable or disable form events from different entities. First I was thinking about creating a new entity named foo_Settings with a few fields and yes/no options to trigger on change events. These events will then add or remove events from another entity.
After doing some research, I couldn't find any examples or cases or any info if this could be done through webservices.
I hope someone can help :)
Greets,
Yes, it is a common design pattern in CRM to have a settings/configuration-entity for storing settings such as this.
You can decide to either have one settings-record per organization, or maybe one settings-record per business unit if that suits your needs better. In this way you can have different configurations depending on the need of each business unit.
After creating the settings record and adding some boolean fields, you would write javascript that runs OnLoad of specific entities. This code would fetch the relevant settings-record, read the value of the relevant boolean-field and add a change listener depending on the value of the boolean by calling addOnChange().
After thinking about the settingspage and ways/solutions to create such functionality, there also was something that was itchy..
By creating a settings page and checking in the onload function of each entity with a fetch (odata call), this is not the most fastest or cleanest way. What if thousands of people are using a entity.. This will resulting that thousands of people will fetch.
So my solution will be:
Creating a settingspage (entity).. Onchange event of a setting will fire a odata call to set a record (true or false) on a hidden field in that entity..
In the onload of the entity I will check the value of that hidden field and do logic. This way I will prevent that there will be an Odata call every time the page loads..
Are there any other solutions?
Currently I am using Jquery Chosen Plugin in order to search the values written inside a search box and it works very well in case I want to search on the basis of the text written inside the option tag. i.e. as shown in the figure:
But what I want to achieve is search on the multiple basis i.e. on the basis of the text written inside the option tag as well as the data attributes of the option tag i.e.
For example in the above figure I may be able to search Debitors either by typing Debitors directly or by typing the data-phone's value i.e.0321-111111. I've searched the chosen plugin's documentation for the possibility to search on the basis of multiple values but, as much as I know, there wasn't any functionality provided by it.
Now what I'd like to ask is, Is there any jQuery plugin providing this multisearch functionality that you may know of?
Thanks.
Finally, I found Select2 Jquery plugin that allows the custom matcher for the searching. i.e. You can define whatever you want plugin's search to search.
I'd like to get some input from the user:
keywords = prompt("Input keywords separated by commas", "");
I have many various strings stored in an SQLite database that could suggest the user what to type.
Let's say you have an array or list of these strings. How would you code this hinting in Javascript? Are there some functions or code snippets for this functionality?
I'd like it to work similarly as here. When you start typing you get hint with possibilities. There is only one disadvantage, that you can't input more strings separated by commas. Here is this feature working with more strings.
Is prompt() function suitable for this purpose? You can use another way of getting user input.
Thank you
You cannot tweak the native prompt() javascript method.
I know you did not tag with jQuery but would be way easier to use a library to implement such a behavior.
You'll have to build your own dialog system using maybe jQuery UI Dialogs. They have an option to make it modal so the UI is blocked until the dialog is closed.
jQuery UI Dialog will not block javascript execution though like prompt does. You might need to be able to execute code when the dialog is closed. This answer show a way to implement that easily.
Finally, the jQuery UI Autocomplete provides an example on how to use it for multiple values in the same input. They use a comma-separator but I guess you could modify the example to work with whitespaces: jQuery UIAutocomplete Multiple Values
You can't really use any custom functionality with prompt().
You'd be better off creating an <input type="text"/> and hooking the whole thing up to a button, making the data get submitted whenever a use clicks it, or presses enter. Then code it to fetch an autosugges value whenever the user types in a new character.
You should take a look at jQuery UI's autocomplete component (it works with multiple strings as an input as well). You would also need to set up a server-side script that will take a possibly incomplete string as an input and output a possible list of matches back to the browser.
I am trying to set up dynamic per-item menus (Edit Control Block) in SharePoint 2007. My goal is to have certain features that are available based on the current user's group membership.
I know that the CustomAction tag that controls the creation of this menu item has a Rights attribute. The problem that I have with this is that the groups I am using have identical rights in the site (ViewListItems, ManageAlerts, etc). The groups that we have set up deal more with function, such as Manager, Employee, etc. We want to be able to assign a custom feature to a group, and have the menu items associated with that feature visible only to members of that group. Everyone has the same basic site permissions, but will have extra options availble based on their login credentials.
I have seen several articles on modifying the Core.js file to hide items in the context menu, but they are an all-or-nothing approach. There is an interesting post at http://blog.thekid.me.uk/archive/2008/04/29/sharepoint-custom-actions-in-a-list-view-webpart.aspx that shows how to dynamically modify the Actions menu. It is trivial to modify this example to check the users group and show or hide the menu based on membership. Unfortunately, this example does not seem to apply to context menu items as evidenced here http://forums.msdn.microsoft.com/en-US/sharepointdevelopment/thread/c2259839-24c4-4a7e-83e5-3925cdd17c44/.
Does anyone know of a way to do this without using javascript? If not, what is the best way to check the user's group from javascript?
There are two different Javascript functions that you can implement for dynamically adding menu items to list item drop downs. Core.js (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\CORE.JS) checks for the existence of these methods when generating the menu items for a selected list item. "Custom_AddDocLibMenuItems" and "Custom_AddListMenuItems" are the names of the Javascript methods.
One article that I think you can use to solve your specific problem, dynamic menu item customization based on user role membership, can be found here:
MSDN: Customizing the Context Menu of Document Library Items (note the process is exactly the same for any list type)
This article outlines how server side code can be executed to define the menu items that will be displayed:
[...] in more complex cases, you must retrieve the list of available commands from the server, because only there you can run your business logic and perhaps get the commands from a custom database. Typically, you want to do this if you are implementing a workflow solution where each document has its own process state, with commands associated to it.
The solution for this situation is to have the Custom_AddDocLibMenuItems dynamically call a custom ASP.NET page. This page takes the ID of the document library and the specific item on the query string, and returns an XML string containing all the information for the commands available for that particular document. These commands are available according to the document's process status (or some other custom business logic). [...]
Unfortunately this is not possible to accomplish without using javascript. The ECB doesn't render server controls defined as a custom action (unlike the SiteActions etc).
To learn how to accomplish this by using Javascript check out the following article:
http://www.helloitsliam.com/archive/2007/08/10/moss2007-%E2%80%93-item-level-menus-investigation.aspx