New datatypes: select and combo boxes that get options from seperate table

New datatypes: select and combo boxes that get options from seperate table

Tuesday 27 July 2004 11:53:26 am - 3 replies

Modified on Tuesday 27 July 2004 11:54:57 am by Hardy Pottinger

Author Message

Paul Forsyth

Wednesday 28 July 2004 12:55:44 am

So, your two new datatypes are actually quite similar. Could both be implemented with the same datatype code but with a different template to render it? Your description sounds similar to the current datatype ezselection. Apart from using a separate table how does it differ?

paul

--
http://www.visionwt.com

Hardy Pottinger

Wednesday 28 July 2004 7:18:26 am

You're correct, they are too similar, and I'll only be coding one datatype. It *is* very similar to the selection datatype, but my goal is to come up with a combo box--a term which is often used to mean select box, but really means a *combination* between a select box and a text field. There's no such thing in HTML's specs, but you can code something very similar by presenting a select box and a text field, and tying together their behavior with javascript (and server-side scripting, as a backup, in case the client browser does not provide javascript capabilities). Here's a good write-up of how the HTML code will work: http://www.cs.tut.fi/~jkorpela/forms/combo.html.

I'm still planning to start with the string datatype, because it will make accessing the data simpler (and will also facilitate importing of legacy data). But I'll be borrowing code from the selection datatype (in particular, the classAttributeContent function).

I really like the idea of using just one datatype for this, because it will give us some freedom with the interface. If suddenly our client declares "No, I don't want the users to be able to enter their own data, they're crazy and are making too many duplicates!" We'll be able to just uncheck a box in the class, and the combo box will revert to a select box.

As long as we're talking about datatypes, we had a need to code up some strings fields with various simple validation rules. Instead of making individual datatypes for this, since the rules were simple enough to code into a single regexp per field, I came up with a datatype that lets you define the regexp validation as part of the class attribute definition in the admin interface. As soon as I'm sure that's working as intended, I'll contribute it to the community.

Paul Forsyth

Wednesday 28 July 2004 7:31:50 am

I know what you are referring to. I've used too many widget toolkits in my time :) Sounds very nice.

Have a good look at the way ezselection works from the db point of view. The main reason for a new datatype is to facilitate the extra storage required by the data. Once you create another class that links in to the datatype content you can pretty much link any other db table to it.

paul

--
http://www.visionwt.com

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.