Jump to content

Module: TextboxList


Nico Knoll
 Share

Recommended Posts

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

post-5023-132614281893_thumb.png

  • Like 3
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 months later...

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?

Link to comment
Share on other sites

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:

public function ___getCompatibleFieldtypes(Field $field) {
   $fieldtypes = new Fieldtypes();
   foreach($this->fuel('fieldtypes') as $fieldtype) {
       if($fieldtype instanceof FieldtypeText) $fieldtypes->add($fieldtype);
   }
   return $fieldtypes; 
}
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?

I can help you get started with this if you'd like. But need more detail.

Link to comment
Share on other sites

  • 6 months later...
  • 5 months later...

Hey Nico,

Module still doesn't seem to be in the directory.

I tried a manual install, but it crashed my site completely - had to delete it to get things running again - might be something weird at my end, but might be worth checking out.

Link to comment
Share on other sites

Sorry, that was a bit lame wasn't it :) 

Basically I got a WSOD.

I am really not sure what happened. I actually had the same issue with the thumbnail module. I just reinstalled yours and it is fine now. Seems like there is something weird on my server. All the other modules I have installed (either manually or through the modules manager) have been fine, but these two have required installing, deleting the folder, and then installing again to get them to work.

I'll let you know if I ever figure it out.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...

Great module, but rather I looking for something like your module which deals with page references and supports autocomplete (other inputfield for Page Autocomplete core module, without jQuery UI dependency *g*).
 
But really great for simple tag style values :)

 

This module reminded me of Select2 - it's like asmSelect supercharged: textboxes like this, filters, custom labels, ajax etc
 
That being said, it would be great to have Select2 as a Page field inputfield in PW.

Yes, that would be awesome! :)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...