# eForm - The Electronic Form Snippet

## Version History

### Version 1.4.4.1 - 1.4.4.8

- eForm now retains default values for check boxes and radio buttons
- text input fields now retain default value set in form template
- Added pixelchutes' phx workaround (use (()) instead of [++] in snippet call)
- Added proper ef_validation_message language string
- FS#960 - removed trimming of $param - values with leading or trailing spaces would always fail validation
- bugfix: &jScript parameter doesn't accept chunks, only a link to a JS file if more than one chunk is declared (eg &jScript=`chunk1,chunk2)
- bugfix: &protectSubmit creates hash for all fields instead of fields declared in &protectSubmit
- bugfix: Auto respond email didn't honour the &sendAsText parameter
- bugfix: The #FUNCTION validation rule for select boxes never calls the function
- bugfix: Validation css class isn't being added to labels.
- Work around for setting required class on check & radio labels
- bugfix: If eform attibute is set on multiple check boxes only the last value is set in values list
- Security fix: Additional sanitization applied after stripslashes is used on fields
- Security fix: Send sendirect, ccsender and autotext mails only to the first mail address of the comma separated list.
- Added: Multiple event functions separated by comma.

### Version 1.4.4

- Fixed various Select box inconsistencies
- Adjusted email validation expression to allow + character.
- Line breaks in 'Html' fields will only be replaced in report template if &sendAsText false!
- Line breaks in 'Html' fields will be replaced in thankyou template when &sendAsText is true
- Properly display session hash name in debug text for &protectsubmit code
- Properly escape regular expression in form parser
- Fixed 0 (zero) values not being processed in form parser for validating select boxes
- Fixed ambiguous variable naming in validation code
- Enhanced efLoadTemplate function to also allow snippets as templates
- &invalidClass now also works for vericode field
- Added &autoSenderName parameter
- Added &runSnippet parameter - Call a snippet before main form processing. See parameter documentation for details.
- Added &snipFolder parameter for those that want to keep different versions of eform in different folders.
- Added $lang['ef_mail_error'] to the language file and a slightly improved error reporting when sending mail fails
- Date formatting for report can now be set in language file: $_lang['ef_date_format']
- Report output is now more locale aware as far as numbers are concerned. Added $_lang['ef_thousands_separator'] to the language file. If set to an empty string (default) the character defined in the current (php) locale will be used (if any).

### Version 1.4.3

- FIXED: When using multiple forms on a page all forms are parsed and validated even when only one form is submitted.
- FIXED: fields array values were not cleared between forms (resulting in setting validation messages in all forms when any of the forms form doesn't validate)
- FIXED: typo in line 78 - thanks to pixelchutes
- Some other issues introduced in the last version have also been addressed

### Version 1.4.2

- New: In-line validation classes. Two new parameters `&requiredClass` and`&invalidClass`. You can use these to set classes for fields and their associated labels when they don't validate. Existing classes will be preserved
- Updated: Validation messages are now inserted including wrapping elements (set in the language file)
- New: You can now also set the `[+validationmessage+]` placeholder outside the form template (eg: in the page template or elsewhere).
- New: Added debug levels: 0:none, 1:validation rules and configuration, 2:print all arrays 3:show parsed template. Some values are only shown when the form is parsed and vaidated (so not the first time the form is displayed)
- Updated: Changed the way date values are verified due to differences in php versions (Raymond Irving)
- Updated: Email character set now follows modx character set (thanks to Gildas)
- New: Added &cssStyle parameter for adding css styles to the <head> tag of the document.
- New: Added &jScript parameter for adding javascript to the <head> tag of the document.
- New: Added &protectSubmit parameter to protect against multiple submits of similar form data
- New: Added &submitLimit parameter for setting a time limit in minutes on successive submits of same form
- Tweak: Now trims the spaces in comma separated sessionVars parameter
- Some other minor tweaks
- Version checking: eForm now checks for and reports differences between snippet and eform.inc.php

### Version 1.4.1

- Fixed: inconsistent casing in event names. All events params are now in the form &eFormOn... (although the &eformOn... will still work)
- Fixed: If subject comes from a form field the value is cleared before merging placeholders
- Updated: Debug placeholder is now automatically added to form and thankyou template. (It is not auto-added to email message to avoid sending out sensitive info, although you can add the placeholder manually offcourse)
- Fixed: Missing language file produces fatal error. (Will now generate a debug message if debug is on)
- Fixed: Missing 'replyto' in AddAddressToMailer function.
- Fixed: Erroneous closing slash (/) being added in <option ..> tags
- Fixed: No whitespace before 'selected' and 'checked' attributes
- New: Extra event parameter `&eformOnBeforeFormParse` (triggered as soon as templates are loaded)
- New: Extra event parameter `&eFormOnFormValidate` (triggered after eForm validation has occurred)
- New: Extra event parameter `&eFormOnBeforeFormMerge` (triggered when and before form is displayed)
- New: Extra event parameter `&eFormOnBeforeFormParse` (triggered after template(s) are loaded and before they are parsed)

### Version 1.4

- New: Extra parameter `&sessionVars`- comma delimited list of S_SESSION variable names that can be added to the list of field values.
- New: Extra parameters `&sendAsHtml`and `&sendAsText`- force email messages to be in Html or text only format.
- Fixed: `&debug`parameter wasn't doing anything
- Fixed: changed erroneous `&isDebug`to correct `&debug`parameter in documentation
- Fixed: Returning 'foreach' error when chunk or document not found for form template
- Fixed: Erroneous error when using multiple forms on a page ($formats persisted between eForm calls)
- Updated: Events now work using the `&eFormOnBeforeMailSent`and `&eFormOnMailSent`paramaters. The previous event structure did not appear to work without some tricks (variables were out of scope)
- Updated: [+subject+] can now be used in report and thank you templates
- Updated: When using a document for the templates the document no longer needs to have published set
- New: Show error if `&tpl`is set to the same document (id) containing the eForm snippet call
- New: extended debug messages for validated fields (if `&debug`is set)
- New: added some protection against mail injection
- New: &reportAbuse parameter - send 'abuse alert' mail to [(mailsender)] if mail injection is noticed
- New: You can now use <form id="formName"...> to match your &formid=`formName` instead of <input type="hidden" name="formid" value="formName" />
- New: You can now set the description using the label tag instead of in the eform attribute eg. <label for="email">Your Email</label><input type="text" name="email" eform=":email:1::"/> instead of <label>Your Email</label><input type="text" name="email" eform="Your Email:email:1::"/> If both are used the eform value takes precedence.
- New: Added &disclaimer parameter for adding a disclaimer to the email body. Can be chunk name or document id Need to manually add [+disclaimer+] placeholder to report template
- Optimized: moved form parser code so it is only executed when form is posted
- Updated: You can again use placeholders in &from and &fromname (as you can with &subject and &keywords)
- Updated: It is now possible to use special placeholders in #SELECT validation rule i.e. #SELECT jobnum FROM translation_jobs WHERE client_email={email}
- New: you can now use the #LIST validation rule for file type checking with file uploads by supplying a list of file extensions eg: #LIST jpg,jpeg,png,gif
- New Examples:
  - How to use eform events
  - Multiple forms on one page

### Version 1.3

- eFormParser included
  This version differs from the original in that it incorporates the eFormParser which retrieves part of it's setting and validation information from the form itself by reading the `eform`pseudo attribute from the form fields. eForm also no longer requires to set placeholders in each form field with the exception of the `[+vericode+]`, `[+verimageurl+]`and `[+validationmessage+]`placeholders.
- Extended Server validation
  It is now possible to set validation rules for each field using a list or range of values, regular expressions an more.
- Language Setting All eForm messages are now stored in a separate language file and a new `&language`parameter has been added.
- Custom validation messages You can now add custom validation messages to each field. The way messages are displayed has also changed slighty. Empty fields will now be listed in one message instead of using a separate message for each field.