MarkZ
MarkZ

Reputation: 21

Creating a custom editForm in Plone&Dexterity, how to save changes to an object?

We are working on a student project at our uni and we have to work with Plone and Dexterity content types.

We created a custom content type and are now trying to create a custom edit form for it. However, we don't seem be able to save anything we enter on the edit form to the Object itself.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
  xmlns:tal="http://xml.zope.org/namespaces/tal"
  xmlns:metal="http://xml.zope.org/namespaces/metal"
  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
  lang="en"
  metal:use-macro="context/main_template/macros/master"
  i18n:domain="pacs.content">
<body>



<metal:main fill-slot="main">
    <metal:main define-macro="main"
       tal:define="currentSelection view/selected_org_unit">

    <div tal:replace="structure provider:plone.abovecontenttitle" />

    <h1 class="documentFirstHeading" tal:content="context/title" />

    <div tal:replace="structure provider:plone.belowcontenttitle" />

    <p class="documentDescription" tal:content="context/shortname" />

    <div tal:replace="structure provider:plone.abovecontentbody" />

    <div tal:content="structure context/projectnr" />        
    <div>
    <fieldset style="border:1px #000 solid">
    <legend>Bereichszuordnung</legend>

        <select name="org_unit" size="1">
            <option value="">Bitte auswählen</option>
            <option
                    tal:repeat="code view/org_units"
                    tal:attributes="value code;
                                            selected python:currentSelection == code and 'selected' or None"
                    tal:content="code"
            />
        </select>
    </fieldset>
    </div>

    <div tal:content="structure context/org_unit" />
    <div tal:content="structure context/project_head" />
    <div tal:content="structure context/confidential" />

    <input id="form-buttons-save" 
    name="form.buttons.save" class="submit-widget button-field context" value="Save" type="submit" />        
    <div tal:replace="structure provider:plone.belowcontentbody" />
    <div metal:use-macro="context/batch_macros/macros/navigation" />

</metal:main>
</metal:main>

Thanks in advance for any help you can offer and I will gladly upload any relevant code.

Upvotes: 0

Views: 506

Answers (1)

hvelarde
hvelarde

Reputation: 2876

Are you registering the edit form?

class EditForm(dexterity.EditForm):
    grok.context(IYourContentType)

Take a look at Custom add and edit forms for more information.

Upvotes: 1

Related Questions