I’ve just completed Validanguage version 0.9.8. In addition, I uploaded an update to the Validanguage CakePHP helper with a couple big fixes and one new feature: the helper will now automatically suppress duplicate rules. For example, if two CakePHP rules would result in a validateRequired() tag being created, only one instance of the tag will be written to the page.
Here’s a breakdown on what’s been added to version 0.9.8:
- Added the new validanguage.substituteText() function — This function lets you specify an array of characters which should be replaced by a second array of characters. This can be used, for example, to make any lowercase letters typed in an input field be automatically changed into uppercase letters. validanguage.substituteText() can be used in conjunction with validanguage.format() and validanguage’s character suppression function to create input fields that dynamically update the user’s input to match the desired format. Several examples of substituteText() appear on the new Text Substitution and Formatting test case page: “CD Key” and “Phone Number” examples that combine validanguage.substituteText(), validanguage.format() and validanguage’s character suppression and a third example of creating a l337 Speak generator using custom arrays supplied to substituteText().
When using validanguage.substituteText, you can use the strings “upper” and “lower” as a shortcut for an array containing the uppercase and lowercase alphabets. Also, when substituteText is called without any arguments, it defaults to replacing all lowercase letters with uppercase.
- Enhancements for using validanguage.format() onkeypress — To allow the dynamic reformatting of text with validanguage.format() as the user types the text, several updates needed to be made to this function to make it work seamlessly. If you wish to use format() as an onkeypress transformation, as illustrated in the Text Substitution and Formatting test case page, you should provide the regular expression “.” as the function’s third parameter to ensure that no matter what the user types, it will always be reformatted.
- Bug fix in multi-line comment support. I forget exactly what this was. I think some attributes would be ignored when defined in comments.
- Bug fix: konqueror was totally broken in prior versions. I feel like an idiot for not noticing this earlier, but apparently konqueror has been totally broken since version 0.9.6
- Bug fix: arrow keys no longer affected by keypress suppresion in Opera. In prior versions, a rule like allow=”alphanumeric” ended up making the arrow keys nonfunctional in Opera.
- Fixed validanguage.toggle(visibility) support for over 2 fields — When trying to use validanguage.toggle() for a radio button with 3 choices, it wouldn’t work correctly. This has been resolved.
- Added validanguage.toggle(toggleAttribute) — The earlier ability to use validanguage.toggle() to change an input field’s value has been deprecated and replaced with the more multi-purpose toggleAttribute command. toggleAttribute allows users to change any attribute (such as a form’s action, or a div’s className). toggle(value) will be removed in the next release, so if you are using it, make sure you update it to use toggleAttribute instead. See the Examples of validanguage.toggle() usage test case for the new syntax.
I have a couple things I’m planning on focusing on over the next month or so. These include:
- Validanguage website redesign — I’d like to split off Validanguage into its own subsection of drlongghost.com. This will include a new, more professional looking design for the site, as well as moving the documentation out of WordPress and into standalone HTML, so I can integrate examples directly into the docs. Also, the new docs will be in a more readable color scheme.
- New open source projects — I have a couple more scripts that I’ll be putting online on my site. These include a couple pieces of Perl and PHP code I’ve developed at work that my employer is nice enough to let me open source.
- Validanguage version 1.0.0 — I’m going to start narrowing down exactly what I want to have implemented prior to declaring a 1.0 release. Feature-wise, I think I’m basically there. One thing I’d like to do is go through the code and do some refactoring to try and shrink the code size. I think that there’s probably a couple kb in cruft that I can shave off. I also want to make some more test cases and try and find any existing bugs hiding in version 0.9.8 prior to 1.0.0 being released. As always, I’d love to hear from anyone using validanguage on what they’d like to see me include in future versions.