## Script (Python) "form_validator" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title=Generates Squishdot postings and polls from form submissions ## from Products.Formulator.Errors import ValidationError, FormValidationError from Products.PythonScripts.standard import DTML ########################################################################### # Information # ########################################################################### # This script requires that certain fields be present within the form that # it is called by. These fields are: # 1) formName: The name of the Formulator form object that the form # fields were generated from # # 2) folder: The relative path to the Squishdot site that the generated # posting should be put in # # 3) aFolder: The relative path to the Archives folder that this # request's data should be stored in # # # This script uses other fields, but they are not necessarily required: # 1) recipient_roles: User roles that should receive notification of # new submissions. If this is left out, nobody # will receive notification when a form is # submitted. # # 2) email: The email address of the person submitting the form. If # this is left out, the email address will be changed to # 'Unknown_Email' # # 3) realname: The name of the person submitting the form. If this is # left out, the name of the person submitting the form # will be changed to 'Anonymous' # # 4) subject: The subject to use for the email message. If this is # left out, the subject will be changed to 'Form Submission' # # 5) poll: Whether or not you would like to make a poll for this post # (1=Make poll, anything else (or omitted)=Do not make poll) # # 6) question: The question to be asked in the poll. If this is left # out, the question will just display as 'Poll' # # 7) responses: The various answers that a user can give for a poll. # This can contain as many as you want, but be aware that # the Squishdot layout will become cluttered if you use # more than three of a general length. Each response # option should be separated by a comma (,). Responses # will be displayed within the Poll in the order that # they are provided in this field. If this is left out, # the poll will not be created. (Kinda hard to have a # poll that does not have any response choices...) # ########################################################################### # Config area # ########################################################################### # The max width of a form field's contents when sent as an email message maxWidth = 65 # Field names that are reserved for use by the script, and should not # be displayed in the generated Squishdot post. DO NOT change this unless # you properly modify the appropriate parts of the script config_fields = ['formName','folder','aFolder','recipient_roles','poll', 'subject','question','responses'] ########################################################################### # Start of actual script # ########################################################################### # Get the value of the Formulator object to use for validation. This is # based on the value of the formName field. This field should have the # same value as the name specified in the