This might be nice for Rapido

I've been building out a small CRUD system in Rapido for a project. Here are some things I'm in the process of figuring out.

  1. How do I create dropdown menus and checkboxes?
    I want this for the edit form for my rapido app
    I should be able to select from options instead of using plain text.
    My dream solution might support a "SELECT" and "BOOL" type and work something like this:
target: ajax
    title: TEXT
    item_type: SELECT
    options: ["Plant","Animal"]
    title: TEXT
    show: BOOL
        type: ACTION
        label: Close
        type: ACTION
        label: Save
        type: ACTION
        label: Delete

I would then get an EDIT interface like this:

The resulting columns might look like this:

It looks like I'll need to do this with .pt templates instead of .html templates.

My current solution/workaround is to create a BASIC type which will generate the select menu.
This is work in progress but in case it helps someone else...

target: ajax
title: TEXT
item_select: BASIC
item_type: TEXT
type: ACTION
label: Close
type: ACTION
label: Save
type: ACTION
label: Delete

and then I plan to generate my select menu (something like this, but more dynamically)

 def item_select(context):
     html = """<select><option>Animal</option><option>Plant</option></select>"""
     return html


by the way, it's probably better to use .pt file and use tal:repeat to produce the options

I'm trying to push the boundaries a bit before resorting to a .pt.

Regarding the SELECT or BOOLEAN types: I do not plan to extend the abilities of Rapido regarding forms, because we already have other solutions for that (collective.easyform and Plomino, which are both very powerful).

When I need a complex form with Rapido, I usually implement it with collective.easyform, and then I hijack its form rendering from a Rapido element:

def form(context):
    easy_form = context.content.getParentNode().manager_form
    html = easy_form.unrestrictedTraverse('@@embedded')()
    return html[html.index('<!-- Default fieldset -->'):html.index(
        '<div class="formControls">')]

And then I get back the submitted values that way:

def save(context):
    easy_form = context.content.getParentNode().manager_form
    fields = context.modules.easyform.get_schema(easy_form)
    record = rapido.get_record(
    if not record:
    for field in fields:
        value = context.request.get('form.widgets.' + field)
        if value:
                value = fields[field].fromUnicode(value)
            record[field] = value
        elif field in record:
            del record[field]

It's hacky but:

  • the form schema can be managed via the interface which lets the ability to non-developers to change it the way they want
  • or it can be managed by importing XML, which is handy for developers

I also do similar things with Plomino.

yup... at least it works!
I'm making progress with just Rapido...
I'm grabbing my custom field info straight out of context.request.form['alert_type']

For example if I have:

<select name="item_type">

I use:


to get the value.

... will see how much further I can get.

I'm making use of an "on_save" function

def on_save(context):
    context.record['item_type'] = context.request.form['item_type']