diff --git a/.gitmodules b/.gitmodules index 0da5590..f4f066c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "thirdparty/jquery-validate"] path = thirdparty/jquery-validate url = git://github.com/jzaefferer/jquery-validation.git +[submodule "thirdparty/Placeholders.js"] + path = thirdparty/Placeholders.js + url = git://github.com/jamesallardice/Placeholders.js.git diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php index 9eb946d..037b66b 100755 --- a/code/model/UserDefinedForm.php +++ b/code/model/UserDefinedForm.php @@ -330,6 +330,7 @@ class UserDefinedForm_Controller extends Page_Controller { Requirements::javascript(FRAMEWORK_DIR .'/thirdparty/jquery/jquery.js'); Requirements::javascript('userforms/thirdparty/jquery-validate/jquery.validate.js'); Requirements::javascript('userforms/javascript/UserForm_frontend.js'); + if($this->HideFieldLabels) Requirements::javascript('userforms/thirdparty/Placeholders.js/Placeholders.min.js'); } /** @@ -506,7 +507,7 @@ class UserDefinedForm_Controller extends Page_Controller { if($this->EnableLiveValidation) $onfocusout = ", onfocusout : function(element) { this.element(element); }"; // Hide field labels (use HTML5 placeholder instead) - if($this->HideFieldLabels) $hidelabels = '$("#Form_Form label.left").each(function(){$("#"+$(this).attr("for")).attr("placeholder",$(this).text());$(this).remove();});'; + if($this->HideFieldLabels) $hidelabels = '$("#Form_Form label.left").each(function(){$("#"+$(this).attr("for")).attr("placeholder",$(this).text());$(this).remove();});Placeholders.init();'; // Set the Form Name $rules = $this->array2json($rules); diff --git a/thirdparty/Placeholders.js b/thirdparty/Placeholders.js new file mode 160000 index 0000000..50833ce --- /dev/null +++ b/thirdparty/Placeholders.js @@ -0,0 +1 @@ +Subproject commit 50833cedc22e2de8061ecdc2fb8f93347ccf30ed