Hello! I'm having some trouble with external validators. This may or may not have something to do with my earlier troubles re. forms. Previously, (before I knew that plone's join_form.pt was using formulator) I was doing manual validation on the fields from join_form.pt. I put code like this in plone_form_scripts\validate_registration: if REQUEST.get('field_shackname', '').startswith('anon@'): errors['shackname'] = 'Sorry... no anons allowed.' Not very pretty, but I didn't know any better. I started getting some odd errors that I am (still) unable to fix, and nobody had anything to say about those errors on the zope list. So I started reading the source code until I found formulator, which looked like a better alternative to manually checking. So I added an external_validator attribute to my form fields in my join_form, then wrote the external_validator as an external script. However, my join_form page never seems to fail from the external validator. I changed the external validator to write a small file to my hard drive, so that I could detect whether or not the function had been called. And the weird thing is that the function isn't being called. Here is the function: def validate_shackname(REQUEST): open(r'f:\new.txt', 'w').write('foo foo') return "ERROR" Here is how I (try) to use it in my join_form.pt: <input type="text" name="field_shackname" size="25" value="shackname" tal:attributes="value shackname" external_validator="validate_shackname"> validate_shackname is the name of the external script, as well as the name of one of it's functions. Is it correct that the function takes REQUEST as a parameter? Is there something I'm doing wrong? and I've still got the error from earlier, where the form doesn't complain when a field is invalid. I don't know if that's related...
participants (1)
-
Ian McMeans