http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89945
Revision: 89945 Author: yaron Date: 2011-06-13 03:43:31 +0000 (Mon, 13 Jun 2011) Log Message: ----------- Added warning Javascript alert if form contains a div ID with a space for "show on select" - that's invalid HTML, and won't work Modified Paths: -------------- trunk/extensions/SemanticForms/libs/SemanticForms.js Modified: trunk/extensions/SemanticForms/libs/SemanticForms.js =================================================================== --- trunk/extensions/SemanticForms/libs/SemanticForms.js 2011-06-13 02:43:52 UTC (rev 89944) +++ trunk/extensions/SemanticForms/libs/SemanticForms.js 2011-06-13 03:43:31 UTC (rev 89945) @@ -321,6 +321,13 @@ // Hide a div due to "show on select". The CSS class is there so that SF can // ignore the div's contents when the form is submitted. function hideDiv(div_id, instanceWrapperDiv) { + // IDs can't contain spaces, and jQuery won't work with such IDs - if + // this one has a space, display an alert. + if ( div_id.indexOf( ' ' ) > -1 ) { + // TODO - this should probably be a language value, instead of + // hardcoded in English. + alert( "Warning: this form has \"show on select\" pointing to an invalid element ID (\"" + div_id + "\") - IDs in HTML cannot contain spaces." ); + } if (instanceWrapperDiv != null) { instanceWrapperDiv.find('[origID=' + div_id + ']').find("span, div").addClass('hiddenBySF'); instanceWrapperDiv.find('[origID=' + div_id + ']').hide(); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs