Can anyone give me some pointers to how to achieve the following:
I'm using CCK and nodeprofiles to let users give me some details of their families, careers, education achievements and leisure interests. I would like to have a "field" a little like the "fullname" field with multiple fields in it.
For example, on the education type, I want to let users fill in an arbitrary number of lines with "qualification, subject, grade, year". On the family form I want to have arbitrary numbers of "child firstname, year of birth, photo, description"
I don't particularly need each of these to be a separate node, though theyt could be if that is the only way of achieving this. I thought, for example, that I could create a "child" content type, allow it to be created on the fly somehow and then put a nodereference field in the family form where it could be created.
Do I need to write a custom field type like the "fullname" field to do this?
Yours hopefully,
Jock
Comments
generic widget maker
i know this is totally off topic but,
i find the profusion of cck widgets to be a bad thing (and i'm about to contribute one more!)
what's needed is a generic widget maker that works like an extended field set so i can
-string together an arbitrary set of fields
-add static content inbetween fields (a line break, a dash, etc.)
-select from a menu of validators for each field in the field set
so you want a zip code+4 field? it's two integer fields separated by a dash
you want an IP address? it's 4 fields separated by dots with the IP Address validator
you want an address? it's a set of text fields, some of which are on the same line, some of which are on different lines, and you use the state and country validators on the respective fields.
this would have people contributing field types and validators instead of entire widgets that are hard to extend and use in novel ways
to respond to the actual question
i believe you'd want to write a custom module for each widget.
then you could add the widget to your content type and allow multiple.
it should be pretty straightforward to take the fullname module and extend it.
Thanks but follow-up...
I thought that might be the answer (and I like your suggestion of a generic widget maker - sadly I'm hopelessly out of my depth to have a go!).
However, as I was patiently hoping for a reply to my original question I was thinking about other ways of doing this, and with some of my types - education for example where I might actually want to sort people by the higher education institution they attended - it might be better this way.
Can I create a type that is, say, university, subject, grade and description and then, when someone edits their education summary page, they get a link or button to create one of those "university, subject, grade and description" types on the fly, maybe even embedded in the "parent" education summary page?
I can obviously theme the view page of the education summary type to embed a view of that person's various education "listings" but it's creating them in the first place - I don't really want them to have to do a "menu/create/education record" to enter it. Does that make sense?
sry, for the late reply if
sry, for the late reply
if you make the education types and such nodes, you can do it with nodefamily and pageroute. Just another content type for it, set a nodefamily relation between the nodeprofile and the new content type. Then create a pageroute for fillling out the profile and a node management page for the education types, which allows the user to add multiple education types to the profile.
Hey! A day's not late...
...except maybe when I'm panicking clueless about how to do something of course!
This does sound like what I was thinking of. I thought maybe it could be done without a pageroute. I was wondering about these settings on the "child" type:
Submit nodes via popup or bookmarklet:
Shortcuts for nodereference fields:
(Provides a set of links to quickly submit new nodes within nodereference autocomplete fields.)
But now that you point it out, I think it could be done quite elegantly with a pageroute.
Cheers,
Jock