UI / Widget for 'Unexisting' Related items

I have a use case that is similar to this (the real use case is more complicated and not about chess):

1 Lets say I have a folders content type, lets call it:


2 Inside Chessplayer I have content types of

 Chess Game

3 In Chess Game schema I have a relation to the 'ChessPlayer' (the opponent )

4 Now, If the other ChessPlayer does not exist, I need to add it before making the relation

5 I would prefer a behavior where I could suggest the Player name (Autocomplete widget maybe), but if I write a name that does not exist, the opponent (ChessPlayer content type) was 'automagically' added.

Any suggestions on how to achieve this ?

I would use this!

Maybe you have to wait until the Chess Game save happens, and handle the magic ChessPlayer creation during the IObjectCreated event

I was thinking about doing it all on save, maybe something like this:

@button.buttonAndHandler(u'Save it')
def handleApply(self, action):
    data, errors = self.extractData()
    if errors:
        self.status = self.formErrorsMessage

    player2 = data['player2']
    relation = api.content.get(UID=player2)

    if relation:
        new_title = relation.Title()
        new_title = player2
        new_player = api.content.create(
        player = new_player.UID()

    new_game = api.content.create(


I assume this should work, and I could use a schema.TextLine for Player and AjaxWidget, maybe

player = schema.TextLine(
    title=_(u'Oponent / player 2 '),

Not sure if that is the correct syntax for 'Single Choice' or if another widget is better

We have this in Plomino with a relation field with datagrid widget and the add feature enabled.
IMO once you start getting into reusing a CMS as a DB then you get into more and more issues where a web content publishing model is too opinionated and you need something designed for data. Plomino is better at modelling these kind of relationships I think. You no longer have to deal with folder structures for a start.

You can fiddle with the widgets toolbar-template and add a button for creation there, i.e by providing an own JS/pattern here.

The custom template can be provided as a pattern option

It is a long time since I looked at Plomingo and in general I think you are right.

But for my use case I need a 'very simple UI' (that means: without the toolbar) mostly for Phones.

If i remember right, that was difficult with Plomino.
If I remember right, Plomino uses a lot of tables in the 'layouts' (?)

For reference:
Looks like one needs an ID to control the number of items that can be selected with javascript. This was the only I could get to work

$('#formfield-form-widgets-player input').select({
	maximumSelectionSize: 1
}).on('select2-opening', function(e) {
	if ($(this).select2('val').length > 0) {

I would create a dynamic vocabulary which calls and returns a list of chess players. On the schema definition you can define if new items are allowable, doing this in combination with an IObjectCreatedEvent would be my plan of attack for something like this.