Module: TextboxList
Started by Nico, Dec 26 2011 03:35 PM
12 replies to this topic
#1
Posted 26 December 2011 - 03:35 PM
Hi,
today I started and finished work on my new module "TextboxList". It includes "FieldtypeTextboxList" and "InputtypeTextboxList". The main function is to create inputfields like Facebook when you have to insert the name of your friend (see the screenshot below).
It automatically creates a new "box" if you press "," or "enter". The result will be saved as a comma-separated list.
It is based on the TextboxList.js of Guillermo Rauch so I wouldn't use this for a commercial project right now. (But I wrote him a mail if he would allow this).
I changed the color schema so it looks like a native element.
I recommend to use it if you have something like a tag list (like: bla, christmas, bla, 2011, bla, ...).
You can download it here: https://github.com/N...oll/TextboxList
Have fun with it!
Greets,
Nico
today I started and finished work on my new module "TextboxList". It includes "FieldtypeTextboxList" and "InputtypeTextboxList". The main function is to create inputfields like Facebook when you have to insert the name of your friend (see the screenshot below).
It automatically creates a new "box" if you press "," or "enter". The result will be saved as a comma-separated list.
It is based on the TextboxList.js of Guillermo Rauch so I wouldn't use this for a commercial project right now. (But I wrote him a mail if he would allow this).
I changed the color schema so it looks like a native element.
I recommend to use it if you have something like a tag list (like: bla, christmas, bla, 2011, bla, ...).
You can download it here: https://github.com/N...oll/TextboxList
Have fun with it!
Greets,
Nico
#2
Posted 26 December 2011 - 04:12 PM
Looks great Nico! One question : does the fieldtype difference somehow from normal textfield? Just thinking if inputfield would be only thing required.
Anyway, based on the screenshot this looks like a very useful module.
Anyway, based on the screenshot this looks like a very useful module.
Follow me at Twitter - Mostly about ProcessWire AdminBar - Simple front end editing for PW ProcessRedirects - Manage redirects in PW-admin
#3
Posted 26 December 2011 - 04:12 PM
Hmm, maybe you're right. I never created a Fieldtype/Inputfield before so I thought I have to create both :)
But I think I need both... Nevertheless a new version is uploaded :)
But I think I need both... Nevertheless a new version is uploaded :)
#4
Posted 26 December 2011 - 05:31 PM
Holy crap, this is great and would come in very handy for blogs (which I would guess is what you're using it on ;)) - does it have an auto-complete option like on Guillermo Rauch's site?
#5
Posted 26 December 2011 - 05:33 PM
No, because I don't know what you want to autocomplete :) (But maybe I'll add one later so that you can define some points in the "Details" page)
#6
Posted 26 December 2011 - 09:29 PM
Looks great Nico, nice work! Seems quite useful now and lots of expansion potential too. My only suggestions would be to remove the 'permanent' from the getModuleInfo on the inputfield. And move the CSS/JS loaders from the fieldtype's sanitizeValue method to the inputfield's init() or render() method. Reason for this is that fieldtypes are supposed to be independent of interactive input, whereas that's what inputfields are for. Otherwise looks great.
#7
Posted 26 December 2011 - 09:53 PM
OK, changed it :)
#8
Posted 27 December 2011 - 04:05 AM
Quote
No, because I don't know what you want to autocomplete :) (But maybe I'll add one later so that you can define some points in the "Details" page)
I was thinking that if you have a "Tags" field then it will search all Tags fields on all pages where the field is used and suggest tags as you type as it does on some of the examples on his site.
I know it's not particularly simple, but on a per-field basis where you would use this it would be neat to have the ability to tick a box to enable this as I can see places where it would be handy and places where you might not want it.
In the tags example it might stop someone adding a tag that's spelled slightly differently by accident or something like that. That's not normally a problem with one author, but could be in a multi-author environment.
#9
Posted 27 December 2011 - 07:14 AM
Love it, Nico! Really nice! Can’t wait to try it.
#10
Posted 27 December 2011 - 07:32 AM
Quote
But I think I need both...
I am pretty sure you only need inputfield at the moment. Unless you need different db schema, or different way to save and retrieve data from db you will be fine with normal textfield. Please correct my Ryan if I am telling lies here :)
Not sure where you are heading with this, so it might be more convenient for you to keep it this way.
Anyways, looking forward to using this - looks like a very useful module. Not sure if I would like to use this with tags, since I like my page references there (they allow easy renaming, removing etc if ever needed).
Follow me at Twitter - Mostly about ProcessWire AdminBar - Simple front end editing for PW ProcessRedirects - Manage redirects in PW-admin
#11
Posted 27 December 2011 - 12:11 PM
I agree this doesn't need the fieldtype at present since it could be designated as an input for the existing textarea. However, there's no harm in giving it it's own fieldtype. Some of the expansion potential may need it.
Nico, if you want to make it PW 2.2 ready, look at the thread on module dependencies in the announcements board. The fieldtype+inputfield is a good 'requires' and 'installs' dependency to use with the new options. Though all are optional.
Nico, if you want to make it PW 2.2 ready, look at the thread on module dependencies in the announcements board. The fieldtype+inputfield is a good 'requires' and 'installs' dependency to use with the new options. Though all are optional.
#12
Posted 17 April 2012 - 04:10 AM
Hi,
unfortunatelly I've got a problem with the module. If I chose "TextboxList" for a field, there's no way to switch back to normal "TextArea". Is this because of the own fieldtype of TextboxList? Is there a way to tell the module what compatible fields are?
In addition, I'd also try to make the InputField independent from the Fieldtype, but I'm not sure if I've got the skills yet...
But perhaps with a little support, I can do it. I think a checkbox, to turn TextboxList als input on an off should be enough, right?
unfortunatelly I've got a problem with the module. If I chose "TextboxList" for a field, there's no way to switch back to normal "TextArea". Is this because of the own fieldtype of TextboxList? Is there a way to tell the module what compatible fields are?
In addition, I'd also try to make the InputField independent from the Fieldtype, but I'm not sure if I've got the skills yet...
But perhaps with a little support, I can do it. I think a checkbox, to turn TextboxList als input on an off should be enough, right?
#13
Posted 17 April 2012 - 09:01 AM
It looks to me like TextboxList's schema is compatible with the Text/Textarea fieldtypes, so the getCompatibleFieldtypes() function in it could be updated to contain this:
I can help you get started with this if you'd like. But need more detail.
public function ___getCompatibleFieldtypes(Field $field) {
$fieldtypes = new Fieldtypes();
foreach($this->fuel('fieldtypes') as $fieldtype) {
if($fieldtype instanceof FieldtypeText) $fieldtypes->add($fieldtype);
}
return $fieldtypes;
}
Quote
In addition, I'd also try to make the InputField independent from the Fieldtype, but I'm not sure if I've got the skills yet...
But perhaps with a little support, I can do it. I think a checkbox, to turn TextboxList als input on an off should be enough, right?
But perhaps with a little support, I can do it. I think a checkbox, to turn TextboxList als input on an off should be enough, right?
I can help you get started with this if you'd like. But need more detail.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












