Jump to content

Feature Request: Add a Name form helper


KT Walrus

Recommended Posts

I need a Name form helper that works similar to the Autocomplete option of the Text form helper, but the input text is not 'tokenized' and supports only autocomplete on a single value.

The Name form helper could extend the Text form helper with nameComplete options. The nameComplete options would include a source option and template options for the result items from the source.

Basically, this would implement a dropdown to autocomplete the Name field as the user types in the input field by attaching JavaScript to this field. No reformatting the input text into tokens needed (like Autocomplete does for tags and member names).

For my site, I am currently using Google Places API to attach an autocomplete menu to certain place names, but I have custom profile fields that need autocomplete (as 'suggestions') for other name types. I just want to have these Name fields 'remember' the values that previous users have submitted for their profiles and help them enter a long name quickly and accurately. One of the name types I need to implement is School graduated from so when I input 'James M' that 'James Madison University, Harrisonburg VA' is among the suggestions and sets the result text to 'James Madison University' if selected for Autocomplete. I will provide the source URL for getting possible Autocomplete values (w/html titles). I also have a table with all Cities in the US so I can implement autocomplete for a City Name without using Google Places API. I have several other Name types I need to implement nameComplete on and using the existing Autocomplete option of a Text field results in a poor user experience (mainly because the resultItem is tokenized making further editing of the value difficult).

Link to comment
Share on other sites

On 6/4/2018 at 12:16 PM, bfarber said:

This is already possible with the Text form helper by setting the autocomplete options. You can set the autocomplete source to anything you want.

No. You didn't quite understand what I'm looking for. I implemented a field using the Text form helper and used the autocomplete options, but it isn't a nice UX for a single name field.

The main problem with the current autocomplete is the entered names are "tokenized". This means the entered names can't be edited (only deleted and entered again). Tokenizing is fine, in some use cases, but not for entering a simple single name. 

Consider my case of entering the name of the college you went to where my site doesn't have a complete list of possible colleges in a table. Rather, my site maintains a table of all colleges that other users have previously entered in the autocomplete form. This table is moderated by the admin so only real colleges are stored in the table. So, the first time a college is entered by a user, the autocomplete will not show the college as a possible name for autocomplete (the college is not in the table of colleges yet).

So, the user enters "Jame Madison University" which is not right and tabs to the next field. Leaving the field, the input text is tokenized. Now, the user reviews the form and spots the mistake, but can't edit the token to add the missing 's'. So, now they have to click on a very small 'x' to delete the token and start all over and type the entire name again. If it were me, I would be frustrated enough to not be able to correct the 's' with a click and a keypress, that I might abandon the form or just delete the token and not actually enter a college (which, on my site, is not required).

The problem is that Autocomplete for Text fields really implemented for 1 or more names in a tokenized list and really is used only for Member Names (where the names the user wants to enter is in the Autocomplete Menu - since all names are known) or used for tags (where the spelling of the tags is not that important for free choice tags and you want to be able to enter multiple tags). I only like tokenizing for Member Names and don't really like it for tags, but one can get used to tokens for tags since this is the way they are displayed in posts (as tokens).

Anyway, you could "fix" Autocomplete to support single text names that may be easily edited as I require, but it is way too complicated to support non-tokenized input with the way Autocomplete is currently implemented (creating a textarea to remember the original autocomplete options, a textarea for resetting the field, and a textarea for the tokenized html).

Much easier to implement a non-tokenizing/non-textarea Autocomplete option for single text names by only attaching JS controller to show a list of possible completions and nothing more than that. Check out this Autocomplete Widget. It is a much better UX for Autocomplete than "tokenizing" entered names.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...