Tres Seaver wrote:

Can you double check that it is actually the default value, and not a
trailing empty line (I'm guessing that you are posting to 'addTeacher'
from a form with a control like:  '<textarea
name="teachers:lines">...').


The complete content of the form is below, and it is very simple. I am very certain that it is not the problem. I have also checked that it isn't an extra checkbox that has been sneaking in there.

I solved the problem by removing the line with the default value in the form, and changing the action method to::

    def editTeachersAction(self, teachers=None, REQUEST=None):
        "Code"
        if not teachers:
            teachers = []

Which is a better way to do it anyway. But that still leaves the bug in the form handling of Zope.

regards Max M


####################


[<a href="edit">Back</a>]<br/><br/>

    <div class="primary_h1">Undervisere tilknyttet uv-forløbet</div>
    <br>

    <form action="editTeachersAction" method="post" name="form"
          tal:define="allTeachers here/users/getAllTeachers">

<input type="hidden" name="teachers:list:default" value="">

<span tal:repeat="teacher python:here.uddan_teacher.getSmartList(here, allTeachers)">
<input type="checkbox" name="teachers:list" value="path"
tal:attributes="value teacher/path; checked teacher/selected">
<span tal:content="teacher/title">title</span><br>
</span>


        <br>
        <br>
        <input type="submit" value=" Gem ">
    </form>












E.g, change the 'teachers:list:default' value to some other string, and see if that value propagates.

Either way, as a robustness measure I would recommend adding some input
checking to 'addTeacher', e.g.:

def addTeacher( self, teachers ):

        """ Add one or more teachers.
        """
        teachers = filter( None, teachers ) # strip empty lines
        # your processing here

Tres.



_______________________________________________ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )

Reply via email to