Title: [Plugin: WordPress Form Manager] XHTML validation and external JavaScript
Last modified: August 20, 2016

---

# [Plugin: WordPress Form Manager] XHTML validation and external JavaScript

 *  Resolved [Nicolas Bouliane](https://wordpress.org/support/users/n1c0_ds/)
 * (@n1c0_ds)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-form-manager-xhtml-validation-and-external-javascript/)
 * Since WordPress uses XHTML, I thought it would be good to enclose the Javascript
   properly in CDATA tags. It would be even better if you simply put the code in
   a javascript file so it gets cached by the browser and works with both HTML and
   XHTML.
 * It’s a very small fix, and I know you update your plugin incredibly quickly, 
   so I thought it might be worth a shot. Keep up the good work; it’s the best forms
   plugin I’ve used so far.
 * XML CDATA:
    [http://www.w3schools.com/xml/xml_cdata.asp](http://www.w3schools.com/xml/xml_cdata.asp)
 * [http://wordpress.org/extend/plugins/wordpress-form-manager/](http://wordpress.org/extend/plugins/wordpress-form-manager/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [hoffcamp](https://wordpress.org/support/users/hoffcamp/)
 * (@hoffcamp)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-form-manager-xhtml-validation-and-external-javascript/#post-2132044)
 * Hey, thanks for the suggestion. You are right, most of the JS that is currently
   echoed with the HTML could me moved into the userscripts.js file, but unfortunately
   some of it is generated dynamically according to the form structure. Is there
   a way to get around this? My concern is that if I generate a special scripts 
   file for each form that the browser will indeed cache it and not load new ones
   as people are playing with changes to their forms. Any suggestions?
 *  Thread Starter [Nicolas Bouliane](https://wordpress.org/support/users/n1c0_ds/)
 * (@n1c0_ds)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-form-manager-xhtml-validation-and-external-javascript/#post-2132093)
 * I am not very familiar with javascript in WordPress, but you could always create
   a javascript.php file that contains it (changing the headers to match the content
   type). This way it wouldn’t produce validation errors with the XHTML doctype.
   Otherwise, you should at least wrap them in CDATA tags (see previous link) so
   they work properly with XHTML, since it’s the official WordPress doctype.
 * You should also avoid displaying javascript on pages where there are no forms
   if possible.
 * These links might help:
    [http://inchoo.net/wordpress/creating-wordpress-plug-in-that-shows-locations-of-current-users-based-on-xml-data-using-dynamically-created-javascript-in-header-of-the-page-and-google-api/](http://inchoo.net/wordpress/creating-wordpress-plug-in-that-shows-locations-of-current-users-based-on-xml-data-using-dynamically-created-javascript-in-header-of-the-page-and-google-api/)
 *  Plugin Author [hoffcamp](https://wordpress.org/support/users/hoffcamp/)
 * (@hoffcamp)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-form-manager-xhtml-validation-and-external-javascript/#post-2132103)
 * Thanks. This might take some time to do correctly / test.
 *  Plugin Author [hoffcamp](https://wordpress.org/support/users/hoffcamp/)
 * (@hoffcamp)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-form-manager-xhtml-validation-and-external-javascript/#post-2132202)
 * For 1.5.13 I moved most of the scripts to userscripts.js. The file is only 8kb,
   and since I would have to scan the post(s) being loaded for the form shortcode
   to know if it was being used or not I figured it wasn’t worth doubling the database
   traffic for each page load over.
 * The dynamically generated scripts I wrapped as a CDATA section, and these only
   appear on pages with a form, unlike before.
 * Thanks for pointing this out – I took the time to validate the output as HTML5
   and cleaned up some other things.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: WordPress Form Manager] XHTML validation and external JavaScript’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-form-manager.svg)
 * [Form Manager](https://wordpress.org/plugins/wordpress-form-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-form-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-form-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-form-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-form-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-form-manager/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [hoffcamp](https://wordpress.org/support/users/hoffcamp/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-form-manager-xhtml-validation-and-external-javascript/#post-2132202)
 * Status: resolved