- dr_munishAsked on March 22, 2016 at 06:53 PM
I am trying to use Autocomplete with list of 27009 MeSH terms. I know NLM also provide XML options for them but I've been able to get list from my colleague. It seems widget imports alright but after few minutes when I check it again, it's not working.
Any suggestions ?Page URL:
- JotForm SupportNik_CAnswered on March 22, 2016 at 07:21 PM
I'm not sure what the problem is, can you elaborate more?
I accessed your form without any problems and I could use autocomplete normally.
So you have 27009 items and when you add them to autocomplete it doesn't work or there is some other issues?
We'll wait for your response.
- dr_munishAnswered on March 22, 2016 at 07:51 PM
Thanks for prompt reply. You are right autocomplete does work fine for first few items, try searching term starting with Z it won't show up. I am not sure if it had something to do with me duplicating fields for 3 MeSH terms. It comes with error "form properties not saved"
- JotForm SupportNik_CAnswered on March 22, 2016 at 08:06 PM
Thank you for clarifying your problem!
So if you would like to input 27000 items, it will not be possible at the moment, since that widget is limited on how many characters it can hold.
If that's the case I'll send this request to our developers for a possible upgrade?
Please let me know if I can be of more assistance to you.
- grade4pagasaAnswered on March 23, 2016 at 12:20 AM
For reference, there's an existing Feature Request for increasing the capacity of the AutoComplete entries initiated by JotForm Support Chriistian in this thread.
- JotForm SupportChriistianAnswered on March 23, 2016 at 12:30 AM
Thank you for the additional information @grade4pagasa. There is indeed a feature request to increase the limit of entries for the Autocomplete widget. I will add this thread to that feature request.
- dr_munishAnswered on March 24, 2016 at 01:39 AM
var input = document.getElementById("suburbs");
as var input = document.getElementById("input_3")
I am not able to get auto-complete from codepen. Ben was suggesting the need to use hide fields. Can you point me to a thread or kb article this has been discussed in detail ?
- JotForm Supportashwin_dAnswered on March 24, 2016 at 03:01 AM
- BorisAnswered on March 24, 2016 at 01:04 PM
I see from the code you've provided that you are working on form 60830194953156, rather than form 60816045941152 that was initially mentioned.
There are several ways we can use to approach this, one of them is what my colleague described in that other thread by using a hidden field.
I believe an easier way would be to directly edit/autocomplete that form field named "only one field". In your test form, the ID of that element you would use for the custom autocompletion code is:
(You can find out IDs of any elements by following this guide.)
This means that in the code example in the original codepen, you would simply replace this line of JS code:
var input = document.getElementById("suburbs");
with this one:
var input = document.getElementById("input_3");
This element does not need to be hidden on the form - in fact, you will be typing into this field. So all you need to do to make it work, is to:
1. Get the full source code of your form: http://www.jotform.com/help/104-How-to-get-your-Form-Source-Code
2. Edit the source code by adding your custom scripts to it, and use the ID of input_3 element in the custom code so that the autocompletion code works on this field directly.
Please try it out and let us know if you run into any snags along the way.
- dr_munishAnswered on March 25, 2016 at 01:25 PM
Boris: I wish it was that simple. I started off doing that obvious change: check comment from March 24, 2016, at 01:39 AM. I've used the code from code pen.io link and replaced one variable like HTML and CSS from source code and behaves alright till I replace jotform.js file elements. I think it is something to do with how Textfield is defined in JS file that undoes the desired behavior.
grade4pagasa probably knows the answer better as he's originally suggested the solution.
- JotForm SupportNik_CAnswered on March 25, 2016 at 01:57 PM
I will try implementing this solution and get back to you as soon as I have some update.
- dr_munishAnswered on March 28, 2016 at 08:06 AM
Thanks Nik_C look forward to your solution.
- JotForm SupportNik_CAnswered on March 28, 2016 at 08:30 AM
I'm sorry it takes this long, I'm still trying to find a workaround for this.
Will keep you posted.
- dr_munishAnswered on March 31, 2016 at 12:20 AM
Do you think referring to JSON instead of adding variables to js file may be better alternative?
- JotForm SupportChriistianAnswered on March 31, 2016 at 01:59 AM
Using JSON seems like a viable option. Although can you try adding the resources in your pen settings to see if that fixes the issue with the autocomplete from codepen?
Do let us know how it goes.
- dr_munishAnswered on April 06, 2016 at 02:44 PM
Chrlistian: Great tools, just like one from grade4pagasa. As the author of the tool, Lea Verou said there are several autocomplete tools out there but the question is integration with Jotform. I've downloaded the source files, added reference in the header to this CSS and JS file in index.html. It doesn't work, maybe I am missing something. Do you mind sharing the zip with this added to the test form ?
Thanks again for all the help. I've tried other web form tools out there over last week and still prefer Jotform over them if we can solve this problem.
- CharlieAnswered on April 06, 2016 at 03:27 PM
Could you please provide us the downloadable XML file or your text list of the MeSH terms?
It's possible that the custom script is conflicting or we are indeed missing something. I'll try to come up with a possible solution but will need to actually see the list you have so that we can better test it.
- dr_munishAnswered on April 07, 2016 at 08:17 AM
Data is from US National Library of Medicine and I've been using CSV mile with one dataset but it can be downloaded in various formats from DTD,ASCII to XML from here https://www.nlm.nih.gov/mesh/filelist.html
Here is link to Excel in my Dropbox Public folder and I only need term: value combinations from it.
- CharlieAnswered on April 07, 2016 at 10:08 AM
Unfortunately, I'm not sure if we could read an outside source like excel and output it in the autocomplete widget or script. It is possible but the tricky part is to how to read the excel file and parse it on JSON.
Perhaps using an XML to JSON converter then using the autocomplete plugin in this link https://leaverou.github.io/awesomplete/ would work. Here's a script that lets you convert the XML to JSON: https://github.com/enkidootech/xml2json.
I also checked the website link https://www.nlm.nih.gov/mesh/download_mesh.html and I'm seeing in this page that the XML file is around 200 MB? I'm not sure if that is an ideal thing to load by a script. Perhaps I'm missing something in your setup. The most practical way that I see this to be accomplish is to import your MeSH terms in a database like a MySQL, after that, you should be able to call them more faster. But it still might be a challenge on how to call them in your auto complete script.
I have forwarded a feature request to update or improve the Auto Complete widget to allow that number of items.