Open quantumJLBass opened 10 years ago
Yes, I did see that in your version of Form ... I'm absolutely in favor of this.
Would you want to tackle this?
You could save some time and grab some of the code from here: https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/master/includes/country-functions.php (don't use states in function names or variables; they're regions. just like you have)
I'd like the static functions dropped in the class.options.php file.
The countries and regions functions should have filters, like the edd functions so they can be extended.
I want to use typeahead for the input fields. See the countries example here: http://twitter.github.io/typeahead.js/examples/ related #151
For static drop downs, the functions in cnHTML should be sufficient.
That sounds fine, help to do it. The only thought is that with that type head is that you can end up with "united states", "United States", "USA", "US", "usa", "us". It looks like there can be some work to test and reformate but it'll be some work. Any thoughts on that part?
There's an option typeahead to autoselect first match, effectively forcing user selection rather than allowing free text input.
Is that what you're asking?
Oh, another option is to use the select function from cnHTML and set it to be an enhanced
drop down. It'll use the Chosen library ... the user has to choose from the list, there is no free text input.
hmm.. the key I think is that if there is a defined list that it is a select from but if there is not then they can enter it? so new regions can be added as there is time to?
Chosen lib is good but it's be odd since you can only choose one, but the typeahead to autoselect I didn't find that so I'll look at that. I'm use to using the jQuery UI autocomplete for dropdowns just because it's in the core and I can make it do most anything.
I'll return on that here right after I finish up on the lay out of the cbn site I've been working on with this. trying to get back to the card part of this.
Oh, I forgot about jQuery UI autocomplete. Its probably best to use that since it is in core.
can do.. I'll come back to this next. thanks
Maybe this function can be utilized rather than hard-coding countries and regions.
https://github.com/alixaxel/phunction/blob/master/phunction/Net.php#L58
Well I just finished the implementation, but I'm very leery of using a server for something like this. I work with a lot of ecom stuff, Magento being one of the major ones, and they all for the most part hard code because of the same reason. I'll do my pull and check it out and we can go from there? I personally rather not see a dependency of this nature since this whole plugin could be used from with in a network that can't curl out side it's self at this point and I think that is a good thing.
Now that this is merged ... you going to add the JS to use the jQuery UI for autcomplete?
Yes, but just a thought here, I used that chosen
plugin on the expanded search .. maybe that would work instead since it's al ready in use?
I did mention Chosen, but you "seemed" against it??? https://github.com/Connections-Business-Directory/Connections/issues/333#issuecomment-37338026
lol yes that is right I missed it, but.. if it was replaced, then all should be replaced I would think. I'm more then happy to write out the jQuery UI replacements, but if you want to stick with the Chosen that's cool to.
Question, since I'm not familiar ... will UI allow "new" input or is it only limited by what is populated like Chosen is?
I know you want consistent exact input ... but I can see others not wanting that so much so both of those scenarios would have to be supported.
Well the thought was that with the UI the autocomplete would be extened as needed. The jQuery ui can be made to do new input, or selected from drop down. Maybe for now till that part is set, the Chosen is used? I'll take a little time and make sure that the jQuery UI replacement will do all of what the Chosen does and cover what we talked about here too? just some other thoughts.
I don't know if you looked at the version of the form plugin I worked on , but I had to add a country and state dropdown, but realized it was not going to cover the admin form. Give al the changes and where you're heading I thought that if the country doesn't have a corresponding state/region array then it fallback to the text input could be added at the same time. The model I started out with is like
and then just out put. I'm know there are 50 ways to skin a cat on this, but I know I need to not allow variance in the states values set per the client terms. any thoughts?