Magicsuggest - How to display selected item with a different label than the suggestion? - magicsuggest

So here's the scenario.
The user can search people by either name or phone number. I like the fact that in the suggestions dropdown, it shows the person's name and phone number... and the text highlighting that goes with it.
However, once they select the person, I want only the person's name to show in the selection. Not the phone number.
Is there a way I can override a label/display function for selected items?
NOTE: I already have a different value/id field. So this needs to be completely independent of that.
Thanks!

Am I the only one here using MagicSuggest?
Anyway... the answer is to set a custom selectionRenderer in the declaraion.
selectionRenderer: function(obj){return obj["shortName"];}

Related

creating a blank option on a drop down list option

Within Excel spreadsheet I would like to create a drop-down list with a blank space incase unknown information has to be inputted. I created a list for the most common information that is inputted but once in a blue moon rare information needs to be logged. Since the information is so rare and unknown it’s not possible to include it within the excel drop down box (since it’s unknown at the moment and will only be used once I therefore don’t want to add it within the drop-down list). I have created the list with a blank spot so I can type in the rare information in but when I click the blank information and try to type in the rare information a box pops up and says, this value doesn’t match the date validation restrictions defined for this cell. Is there a way to overcome this in Excel?
enter image description here
Also, once that problem is solved, I would also like to also have a drop list always present in the column (not just when the field is selected) and I did go to insert and symbols Wingdings 3: 128 but that didn’t work. Maybe it’s because I have included a blank slot in the drop-down list. What am I doing wrong? Thanks in advance.
I think a dropdown list can only have predefined values. If you need other potential values, you would need to add an additional column for that data. Maybe use an option of "Other" in the dropdown and have an extra column for unusual values.

XPages: DropDown selection of documents

I have a VERY general question and am not 100% sure if I am just being lazy or what, I just cannot seem to get a handle on where to start :o)
I am new to XPages programming and have created an application that works well enough, the problem is that I would like to UI to be totally different to what I have. I find that my implementation is much too "Notes like" and not "Web like" enough. OK, enough whining - I have a document that contains a county, a province, a city and some text to that particular city. Currently I display a view (XPage) listing all documents by county / province / city. The user then selects the city document which is then opened to display the text. Works well enough. As you can see very "Notes like". What I would like is this: The user sees 3 drop down fields (two of which cannot be selected), s/he then selects the country from the drop down. The province field now becomes active only displaying the provinces for that Country. S/he selects the province and all the cities are now is the next drop down - once you select the city the text is displayed below the city name. Quite simple I thought - now matter what I do I cannot get this to work :o(
Any pointers (maybe an example app somewhere?).
Thanks in advance
Greetings
Ursus
First thing you should do is get a copy of the Mastering XPages book and read through that. Then you should look at how rendering and partial refreshes will help you do what you want.
You are going to want to set the rendering to false until you enter some value in the previous field. Then, in the event, you determine if the value is valid and set a flag (could be a simple viewScope) and do a partial refresh of the next field. In that field's properties, you check the viewScope flag that you just set in the previous field and if it is correct, you reset the rendering to true to show the field.
We have implemented exactly that kind of feature on the homepage of ilsschools.co.uk using client side onchange event:
var com2 = XSP.getElementById("#{id:comboBox2}");
XSP.partialRefreshGet("#{id:comboBox2}",
{ onComplete : com2.selectedIndex = 0 });
We get the element we want to refresh (i.e. comboBox2 and we do this for comboxBox3, 4 etc as well). Then we use partialRefreshGet to refresh the choices in comboBox2, this can be repeated for 3, 4 and other comboBoxes as well. You can compute the disabled property of a comboBox to disable it. You can compute the selections for a comboBox using SSJS.
Hope this helps.

Searching in a list field containing checkboxes

I want to implement similar functionality as in an address book of any android device with an addition of checkboxes in the list. But I want to implement it in BlackBerry and the support has to be given from OS 4.5+.
The screen should contain a search text field for searching names. Below the text box should be a list field with checkboxes with the names.
As I type in the search field, with every letter added or deleted, my list should show the relevant names and I should be able to check or uncheck the names. Also when i type next name, the one checked before should remain checked. At the end, i want all the checked contacts to be stored in a vector.

Customize Survey fields in Sharepoint 2007

I have a Survey list which has several questions, one of those is people picker field and the another one is single line of text field.
I need to hide a perticular question ( field ) based on login user. Requirement is as below
When the user logs in as admin
a. Display ‘people picker’ and should not allow user to pick his name from people picker.
b. Hide Single line of Text field.
When the user logs in as ‘Non-Admin’
a. Display ‘Single line of Text' field and default it to have the logged in user name (without domain name).
b. Hide ‘People picker’ control.
I am thinking that we can do it by placing javascript in content editor webpart and add it in newform.apx of survey list. Can anybody give me the proper approach to get it done?
Thanks in advance
You might like to try creating a custom field control, a differnet one for each field.
Javascript is fast and involves minimal deployment, but is fiddly and can be turned off.

Does comma seperated list in a search box indicate ALL or ANY?

We have a reporting web site and in the search screen most of the fields are comboboxes. We then AND all the fields together to get a filtered list of records. For example if i chose NY in the City dropdown and priority 1 in the priority dropdown and sales in the team dropdown, it would general something that looked like this (pseudo SQL)
Show me all record where City = 'NY' AND Priotity = '1' AND Team = 'Sales'
We now just added tagging to our records so to support searching by tag(s), we added an additional textbox to search by TAG where you can entered a comma seperated list.
Right now this is an autocomplete textbox which supports multiple entries.(similar to the Multiple Cities (local) example on this page.
When we rolled it out people had different expectation on how search would work when you entered multiple items in the text box. Would it:
Do an AND and only return records that had ALL of the tags listed.
Do an OR and return records that has ANY of the tags listed.
It turns out that we rolled out #1 but many people expected #2. Is this just basically preference or is there a default standard here in this example. Our only solution right now is to add a radio button next to the textbox to say ALL or ANY
If your users expect it to work one way then that's the way it should work.
This is a great example of why you should test early and often with actual users.
I'd say it is not basically preference, but expectations based on what users experience in other types of searches. The "OR" was probably expected by your users as use of tagging gets pretty close to being like a search engine searching on any word in a text and most search engines do an "OR" and then order the results according to how many terms (tags) were "hit".
If going all the way supporting AND and OR operators is not feasible right now, then I would indeed offer an "All" versus "Any" radio button and default it to "Any".

Resources